Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. int j=8; //LEDS start at pin 8
  2.  
  3. void setup() { //setup() is only gone through once
  4. for(int i=0; i<4; i++)
  5. //You have to tell the arduinoboard if pins are INPUT or OUTPUT
  6. pinMode(j+i, OUTPUT); //make LED-pins outputs.
  7. //Look at image over board. Top row is for programming pins.
  8. //The pins can also take input
  9. //I suppose for example the thermometer has to take input,
  10. //that is you take input FROM the thermometer and read it somehow.
  11. }
  12.  
  13. // the loop function runs over and over again forever
  14. void loop() {
  15.  
  16. digitalWrite(j, HIGH); //Turn pin on, this case LED
  17. delay(100); //delay 0.1seconds
  18. digitalWrite(j, LOW); //Turn it off
  19. delay(100); //delay 0.1seconds
  20. j++; //Target next pin.
  21. if( j>11) //if J will become 12, that is we were on the last LED-pin
  22. j=8; //start over on pin 8, that is, the RED LED-pin.
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement