int start = 12;
int restart = 13;
int seg[] = {5, 6, 7, 8, 9, 10, 11};
int display[] = {1, 2, 3, 4};
int numbers[] = {
B11111100, // 0
B01100000, // 1
B11011010, // 2
B11110010, // 3
B01100110, // 4
B10110110, // 5
B10111110, // 6
B11100000, // 7
B11111110, // 8
B11110110 // 9
};
int tenths = 0;
int hundred = 0;
int minutes = 0;
bool running = false;
void setup() {
pinMode(start, INPUT_PULLUP);
pinMode(restart, INPUT_PULLUP);
for (int i = 0; i < 4; i++) {
pinMode(display[i], OUTPUT);
}
for (int i = 0; i < 7; i++) {
pinMode(seg[i], OUTPUT);
}
}
void loop() {
int startState = digitalRead(start);
int restartState = digitalRead(restart);
if (startState == LOW) {
delay(20);
if (digitalRead(start) == LOW) {
running= !running;
while (digitalRead(start) == LOW);
}
}
if (restartState == LOW) {
delay(20);
if (digitalRead(restart) == LOW) {
tenths = 0;
hundred = 0;
minutes = 0;
while (digitalRead(restart) == LOW);
}
}
if (running) {
for (int i = 0; i < 999; i++) {
}
hundred++;
if (hundred >= 99) {
hundred = 0;
tenths++;
}
if (tenths > 6) {
tenths = 0;
minutes++;
}
if (minutes >= 9) {
}
}
Serial.print(running);
Serial.print(tenths);
}