Advertisement
Guest User

Untitled

a guest
Jan 26th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. int leds[5] = {13, 12, 11, 10, 9};
  2. int buttons[5] = {8, 7, 6, 5, 4};
  3. int niveau = 0;
  4. int ledList[32];
  5.  
  6. void setup() {
  7.     for(int i = 0; i<5;i++){
  8.         pinMode(leds[i], OUTPUT);
  9.         pinMode(buttons[i],INPUT); //Initializing button as input
  10.         digitalWrite(buttons[i],HIGH); //Enabling the internal Arduino pullup-resistor
  11.     }
  12. }
  13. void ledSequence()
  14. {
  15.     for(int i=0; i<=niveau; i++)
  16.     {
  17.         digitalWrite(ledList[i + 8],HIGH);
  18.         delay(1000);
  19.         digitalWrite(ledList[i + 8],LOW);
  20.         delay(1000);
  21.     }
  22. }
  23. void loop()
  24. {
  25.     ledList[niveau] = random(1 , 5);
  26.     ledSequence();
  27.     delay(2000);
  28.     niveau++;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement