#define button 3
#define LED 1
#define twoLED 2
#define threeLED 4
#define fourLED 5
#define fiveLED 6
#define sixLED 7
#define sevenLED 8
#define eightLED 9
#define nineLED 10
#define tenLED 11
int state = 0;
int old = 0;
int buttonPoll = 0;
void setup() {
pinMode (3, INPUT_PULLUP);
pinMode (11, OUTPUT);
pinMode(LED, OUTPUT);
pinMode(twoLED, OUTPUT);
pinMode(threeLED, OUTPUT);
pinMode(fourLED, OUTPUT);
pinMode(fiveLED, OUTPUT);
pinMode(sixLED, OUTPUT);
pinMode(sevenLED, OUTPUT);
pinMode(eightLED, OUTPUT);
pinMode(nineLED, OUTPUT);
pinMode(tenLED, OUTPUT);
digitalWrite(LED, LOW);
digitalWrite(twoLED, LOW);
digitalWrite(threeLED, LOW);
digitalWrite(fourLED, LOW);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
}
void loop() {
while (state == old)
{
buttonPoll = digitalRead (3);
if (buttonPoll == 1)
{
delay (50);
buttonPoll = digitalRead (3);
if (buttonPoll == 0)
{
state = old + 1;
}
}
else
{
delay(100);
}
}
switch (state) {
case 1:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, LOW);
digitalWrite(threeLED, LOW);
digitalWrite(fourLED, LOW);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 2:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, LOW);
digitalWrite(fourLED, LOW);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 3:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, LOW);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 4:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 5:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 6:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, HIGH);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 7:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, HIGH);
digitalWrite(sevenLED, HIGH);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 8:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, HIGH);
digitalWrite(sevenLED, HIGH);
digitalWrite(eightLED, HIGH);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = state;
break;
case 9:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, HIGH);
digitalWrite(sevenLED, HIGH);
digitalWrite(eightLED, HIGH);
digitalWrite(nineLED, HIGH);
digitalWrite(tenLED, LOW);
old = state;
break;
case 10:
digitalWrite(LED, HIGH);
digitalWrite(twoLED, HIGH);
digitalWrite(threeLED, HIGH);
digitalWrite(fourLED, HIGH);
digitalWrite(fiveLED, HIGH);
digitalWrite(sixLED, HIGH);
digitalWrite(sevenLED, HIGH);
digitalWrite(eightLED, HIGH);
digitalWrite(nineLED, HIGH);
digitalWrite(tenLED, HIGH);
old = 0;
state = 0;
tone (11, 261);
delay(250);
tone(11, 330);
delay(250);
tone(11, 391.99);
delay(250);
tone(11, 440);
delay(250);
tone(11, 391.995);
delay(250);
tone(11, 330);
delay(250);
noTone(11);
break;
default:
digitalWrite(LED, LOW);
digitalWrite(twoLED, LOW);
digitalWrite(threeLED, LOW);
digitalWrite(fourLED, LOW);
digitalWrite(fiveLED, LOW);
digitalWrite(sixLED, LOW);
digitalWrite(sevenLED, LOW);
digitalWrite(eightLED, LOW);
digitalWrite(nineLED, LOW);
digitalWrite(tenLED, LOW);
old = 0;
break;
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
led9:A
led9:C
sw1:1
sw1:2
sw1:3
led10:A
led10:C
buzzer:1
buzzer:2