byte mask = B01111111;
int Go = 0;
int delaytime = 1000;
int pausetime = 0;
int next = 0;
void setup() {
for (int i = 4; i <= 10; i++) {
pinMode(i, OUTPUT);
}
pinMode(12, INPUT); //Switch
DDRD = mask;
}
void loop() {
bool Read = digitalRead(12);
int currenttime = millis();
if (Read == 1) {
Go++;
}
else if (Go >= 2) {
Go = 0;
next = next;
currenttime = currenttime;
}
if (Go == 0) {
next = next;
currenttime = currenttime;
}
if (Go == 1) {
if (currenttime = delaytime) {
next++;
currenttime = currenttime - 999;
if (next == 1) {
PORTD = B1000000; //0
}
if (next == 2) {
PORTD = B1111001; //1
}
if (next == 3) {
PORTD = B0100100; //2
}
if (next == 4) {
PORTD = B0110000; //3
}
if (next == 5) {
PORTD = B0011001; //4
}
if (next == 6) {
PORTD = B0010010; //5
}
if (next == 7) {
PORTD = B0000010; //6
}
if (next == 8) {
PORTD = B1111000; //7
}
if (next == 9) {
PORTD = B0000000; //8
}
if (next == 10) {
PORTD = B0010000; //9
}
if (next == 11) {
PORTD = B0001000; //A
}
if (next == 12) {
PORTD = B0000011; //B
}
if (next == 13) {
PORTD = B1000110; //C
}
if (next == 14) {
PORTD = B0100001; //D
}
if (next == 15) {
PORTD = B0000110; //E
}
if (next == 16) {
PORTD = B0001110; //F
}
if (next >= 17) {
next = 0;
}
}
}
}