06 March 2010
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;>
Subscribe to:
Post Comments (Atom)
THAT's solved THAT problem (of the 'hard breaks')
ReplyDeleteNow all we need is a captain's knock from Dan Vettori coz NZ are right up the creek in a barbed-wire waka without a paddle!