Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int leds[5] = {13, 12, 11, 10, 9};
- int buttons[5] = {8, 7, 6, 5, 4};
- int niveau = 0;
- int ledList[32];
- void setup() {
- for(int i = 0; i<5;i++){
- pinMode(leds[i], OUTPUT);
- pinMode(buttons[i],INPUT); //Initializing button as input
- digitalWrite(buttons[i],HIGH); //Enabling the internal Arduino pullup-resistor
- }
- }
- void ledSequence()
- {
- for(int i=0; i<=niveau; i++)
- {
- digitalWrite(ledList[i + 8],HIGH);
- delay(1000);
- digitalWrite(ledList[i + 8],LOW);
- delay(1000);
- }
- }
- void loop()
- {
- ledList[niveau] = random(1 , 5);
- ledSequence();
- delay(2000);
- niveau++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement