06 March 2010

Task 20 - ramping the LED rate UP then DOWN again

/*
* Project: Blink2-Task 20
* Author: Jane-Maree Howard
* Date: Saturday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
* In this case, One LED blinks 5 times & the other once, & repeats
* There is also a varying blink rate of the Yellow LED,
* from 10ms up to 1 sec & back down again.
* Here we use two 'for-loops': one to ramp up the Delays, &
* the other to ramp them back down again
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 10; // delay variable - now 10 milliseconds

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 4 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*400); // delay 4 seconds (400 * 10ms)
}//end setup()

// Loop turns yellow LED (pin12) off, red LED (pin 11) on, waits 2 seconds,
// turns red LED off & runs a 'for-loop' 5 times:
// turn yellow LED on & off, with varying delay each time loop runs, &..
// ..repeats endlessly while Arduino has power
void loop()
{
//Ramps delays UP - Red LED stays ON thru Yellow LED loop
for (dLayXier=1; dLayXier<=100; dLayXier++) //ramp delay times UP { digitalWrite(ylwLedPin, LOW); // turn yellow LED off digitalWrite(redLedPin, HIGH); // turn red LED on & leave it ON delay(200*dLay); // delay 2 seconds for (int i=0; i<5; dlayxier="100;">1; dLayXier--) //ramp delay times DOWN
{
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(200*dLay); // delay 2 seconds
digitalWrite(redLedPin, LOW); // First turn red LED off
for (int i=0; i<5;>

Task 19 - like Task 18 but the Yellow LED blink time increases: 100ms to 1 sec

/*
* Project: Blink2-Task 19
* Author: Jane-Maree Howard
* Date: Saturday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
* In this case, One LED blinks 5 times & the other once, & repeat
* Again, the difference from task 15/16 is that here we use a 'for-loop'
* There is also an increasing blink rate of the Yellow LED, from 100ms to 1 * sec.This is achieved with an incrementing variable outside the 'for-loop'
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 100; // delay variable - now 100 milliseconds
int dLayXier = 1; // delay multiplier to ramp up the yellow LED blink rate from 100ms to 1 sec

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 4 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*40); // delay 4 seconds (40 * 100ms)
}//end setup()

// Loop turns yellow LED (pin12) off, red LED (pin 11) on, waits six seconds,
// turns red LED off & runs a 'for-loop' 5 times:
// turn yellow LED on & off, with increasing delay each time loop runs, &..
// ..repeats endlessly while Arduino has power
void loop()
{
if (dLayXier > 10) dLayXier = 1; // check multiplier value
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(40*dLay); // delay 4 seconds
digitalWrite(redLedPin, LOW); // First turn red LED off
for (int i=0; i<5; dlayxier =" ++dLayXier;">

Task 18 - like Task 17 but the Yellow LED blinks 11 times


/*
* Project: Blink2-task 18
* Author: Jane-Maree Howard
* Date: Tuesday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
* In this case, One LED blinks eleven times & the other once, & repeat
* Again, the difference from task 15/16 is that here we use a 'for-loop'
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 8 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds
}//end setup()

// Loop turns yellow LED (pin12) off, red LED (pin 11) on, waits six seconds,
// turns red LED off & runs a 'for-loop' 11 times:
// turn yellow LED on & off, with one second delay each time, &..
// ..repeats endlessly while Arduino has power
void loop()
{
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(6*dLay); // delay 6 seconds
digitalWrite(redLedPin, LOW); // First turn red LED off
for (int i=0; i<11;>

Task 17 - RedLED on & YellowLED off; redLED off & yellowLED blinks 5 times


/*
* Project: Blink2-task 17
* Author: Jane-Maree Howard
* Date: Tuesday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
* In this case, One LED blinks five times & the other once, & repeat
* The difference from task 15/16 is that here we use a 'for-loop'
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 8 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds
}//end setup()

// Loop turns yellow LED (pin12) off, red LED (pin 11) on, waits six seconds,
// turns red LED off & runs a 'for-loop' 5 times:
// turn yellow LED on & off, with one second delay each time, &..
// ..repeats endlessly while Arduino has power
void loop()
{
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(6*dLay); // delay 6 seconds
digitalWrite(redLedPin, LOW); // First turn red LED off
for (int i=0; i<5;>

Task 15 - red LED on, yellow LED off, then red off & yellow blinks twice then red on again



/*

* Project: Blink2-task 15
* Author: Jane-Maree Howard
* Date: Tuesday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
* In this case, One LED blinks twice & the other once, & repeat
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 8 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds
}//end setup()


// Loop turns yellow LED (pin12) off, red LED (pin 11) on, waits six seconds,
// turns red LED off & yellow LED on & off twice, with one second delay each
time, &..
// ..repeats endlessly while Arduino has power

void loop()
{
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(6*dLay); // delay 6 seconds
digitalWrite(redLedPin, LOW); // First turn red LED off
digitalWrite(ylwLedPin, HIGH); // NOW turn yellow LED on..
delay(dLay); // ..delay 1 second..
digitalWrite(ylwLedPin, LOW); // ..turn yellow LED off..
delay(dLay); // ..delay 1 second..
digitalWrite(ylwLedPin, HIGH); // ..turn yellow LED on & ..
delay(dLay); // ..delay 1 second
}//end loop()


New hardware - USB stuff

Shot over to Dick Smith (YES i know i could probably have done better) & grabbed one of those little octopussy USB Squid Hubs

(Should it be a Quadropussy Squid?
Would David Bellamy or that other bloke be amused..)

Anyway, got it working @ D208 @ present,
gonna save me a lot of messing about @home
Got 4 little tentacles on it so i'm plugging my Portable HDD & the Arduino Board into it..

Now all i need is More Memory!!

Task 14 - like Task 13 but with the LEDs reversed



/*

* Project: Blink2-task 14
* Author: Jane-Maree Howard
* Date: Tuesday 06/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for the built-in LED &
external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
*/


int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable


// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 8 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds
}//end setup()


// Loop turns yellow LED (pin12) on, red LED (pin 11) off, waits six seconds,
// turns yellow LED off & red LED on, waits one second, &..
// ..repeats endlessly while Arduino has power
void loop()
{
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(6*dLay); // delay 6 seconds
digitalWrite(ylwLedPin, HIGH); // turn yellow LED on
digitalWrite(redLedPin, LOW); // turn red LED off
delay(dLay); // delay 1 second
}//end loop()


Task 13 - Blink2 program with one LED mostly off, the other mostly on



/*

* Project: Blink2-task 13
* Author: Jane-Maree Howard
* Date: Tuesday 02/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for the built-in LED &
external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn on the on-board LED & wait 8 seconds
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds
}//end setup()

// Loop turns yellow LED (pin12) on, red LED (pin 11) off, waits six seconds,
// turns yellow LED off & red LED on, waits one second, &..
// ..repeats endlessly while Arduino has power
void loop()
{
digitalWrite(ylwLedPin, HIGH); // turn yellow LED on
digitalWrite(redLedPin, LOW); // turn red LED off
delay(6*dLay); // delay 6 seconds
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(dLay); // delay 1 second
}//end loop()

Task 11 - original Blink2 program



//Blink 2. Get two LEDs to blink.

/*
Blink2
Turns on a LED on for half a second, then off for half a second, repeatedly. It
also does the same to an off-board LED connected to pin 12 so that when one
LED is on the other is off.

The circuit:
* LED connected from digital pin 13 to ground via resistor.
* second LED connected from digital pin 12 to ground via resistor. I used 330
ohms.
* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13.

Created 1 June 2005
By David Cuartielles. Adapted by Peter Brook
based on an orginal by H. Barragan for the Wiring i/o board

*/

int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 13
int del =500;

// The setup() method runs once, when the sketch starts
void setup()
{

// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
digitalWrite(redLedPin, LOW); // set the LED on
delay(del); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, HIGH); // set the LED off
delay(del); // wait for a second
}

Task 12 - turn 1 off-board LED on while the other is turned off, delay, then reverse LED states



/*

* Project: blink-task12
* Author: Jane-Maree Howard
* Date: Tuesday 05/03/2010
* Platform: Arduino 18
* Purpose: To demonstrate variable blink times for the built-in LED & external LEDs
* Operation: Sets up output pins (3 off) in setup() method;
* Declares pin definition variables (3 off)
* Defines loop() to perform various LED blinking & delay operations
*/

int ledPin = 13; // on-board LED connected to digital pin 13
int ylwLedPin = 12; // yellow LED connected to digital pin 12
int redLedPin = 11; // red LED connected to digital pin 11
int dLay = 1000; // delay variable

// The setup() method runs once, when the sketch starts
void setup()
{
// initialize the 3 digital pins as outputs:
pinMode(ledPin, OUTPUT);
pinMode(ylwLedPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
// turn them all on, wait, then turn both off-board LEDs off, wait, then begin loop()
digitalWrite(ylwLedPin, HIGH); // turn yellow LED on
digitalWrite(redLedPin, HIGH); // turn red LED on
digitalWrite(ledPin, HIGH); // turn on-board LED on
delay(dLay*8); // delay 8 seconds

digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, LOW); // turn red LED off
}//end setup()

void loop()
{
delay(4*dLay); // first, wait for 4 seconds
digitalWrite(ylwLedPin, LOW); // turn yellow LED off
digitalWrite(redLedPin, HIGH); // turn red LED on
delay(4*dLay); // delay 4 seconds
digitalWrite(ylwLedPin, HIGH); // turn yellow LED on
digitalWrite(redLedPin, LOW); // turn red LED off
}//end loop()


//note that on-board LED stays on continously