06 March 2010

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;>

1 comment:

  1. Yuk just noticed!!
    'Tuesday' in my posts has a variety of dates {sigh}
    It's actually SATURDAY

    ..& we require 91 runs to beat the OZ (but i'm not putting the mockers on anyone by mentioning any NAMES)

    ReplyDelete