Advertisement
tiodocomputador

Blink com 2 Leds

May 14th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. /*
  2.   Blink
  3.   Turns on an LED on for one second, then off for one second, repeatedly.
  4.  
  5.   This example code is in the public domain.
  6.  */
  7.  
  8. // Pin 13 has an LED connected on most Arduino boards.
  9. // give it a name:
  10. int ledA = 13;
  11. int ledB = 12;
  12. int t = 500;
  13. // the setup routine runs once when you press reset:
  14. void setup()
  15. {                
  16.   // initialize the digital pin as an output.
  17.   pinMode(ledA, OUTPUT);
  18.   pinMode(ledB, OUTPUT);  
  19. }
  20.  
  21. // the loop routine runs over and over again forever:
  22. void loop()
  23. {
  24.   digitalWrite(ledA, HIGH);   // turn the LED on (HIGH is the voltage level)
  25.   digitalWrite(ledB, HIGH);   // turn the LED on (HIGH is the voltage level)  
  26.   delay(t);               // wait for a second
  27.   digitalWrite(ledA, LOW);    // turn the LED off by making the voltage LOW
  28.     digitalWrite(ledB, HIGH);   // turn the LED on (HIGH is the voltage level)
  29.   delay(t);               // wait for a second
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement