2012年4月15日 星期日

HO09_03: Seven Colorful LEDs

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:

pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}

void loop() {
while(1)
{
for(int i=1; i<=7; i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(100); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(100);
}
}
}

**********************************************************************************

It show seven colorful LED with using port1 to port7. It has same duration to turn on and off.



沒有留言:

張貼留言