_03_flowingLed.ino 969 B

123456789101112131415161718192021222324252627282930
  1. /***********************************************************
  2. File name: 03_flowingLed.ino
  3. Description: LED turn lighting control
  4. Website: www.adeept.com
  5. E-mail: support@adeept.com
  6. Author: Tom
  7. Date: 2015/05/02
  8. ***********************************************************/
  9. void setup()
  10. {
  11. unsigned char ledPin; //ledPin will be set to 1,2,3,4,5,6, 7 and 8.
  12. for(ledPin=1;ledPin<=8;ledPin++)//In turn set 1 ~ 8 digital pins to output mode
  13. pinMode(ledPin,OUTPUT); //Set the ledPin pin to output mode
  14. }
  15. void loop()
  16. {
  17. unsigned char ledPin; //ledPin will be set to 1,2,3,4,5,6, 7 and 8.
  18. for(ledPin=1;ledPin<=8;ledPin++)//Every 200ms on in order LED1 ~ 8
  19. {
  20. digitalWrite(ledPin,HIGH); //led on
  21. delay(200); //Delay 200 ms
  22. }
  23. for(ledPin=1;ledPin<=8;ledPin++)//Every 200ms off in order LED1 ~ 8
  24. {
  25. digitalWrite(ledPin,LOW); //led off
  26. delay(200); //Delay 200 ms
  27. }
  28. }