2012年4月12日 星期四

Blinking 7 leds

http://www.youtube.com/watch?v=_R1HTtfCK1I

/*
  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:
  for (int i=7;i<=13; i++)
 
  pinMode(i,OUTPUT);
}
void loop() {
  for (int i=7; i<=13;i++)
  {
    digitalWrite(i, HIGH);   // set the LED on
  delay(200);  // wait for a second
  digitalWrite(i, LOW);    // set the LED off
  delay(50);
  }
    for (int i=13; 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);
  }
 
              
 
}

沒有留言:

張貼留言