#include <Arduino.h>
#include <TM1637Display.h>
#define coinSlot 2
#define CLK 5
#define DIO 6
#define TEST_DELAY 15000
uint8_t allDigits[] = { 0xff, 0xff, 0xff, 0xff };
uint8_t blank[] = { 0x0, 0x0, 0x0, 0x0 };
TM1637Display display(CLK, DIO);
int coinSlotStatus;
int h = 0;
int m = 0;
int s = 0;
boolean minutes = true;
void setup() {
display.setBrightness(0x0f);
display.setSegments(blank);
display.showNumberDec(0, true);
pinMode(coinSlot, INPUT_PULLUP);
}
void loop() {
coinSlotStatus = digitalRead(coinSlot);
delay(30);
if(coinSlotStatus == 0){
m += 5;
display.showNumberDecEx(m, 0b11100000, true, 2, 0);
delay(30);
}
if(coinSlotStatus == 0){
//count down for seconds
for(int s = 59; s >= 0; s--){
display.showNumberDecEx(s, 0b11100000, true, 2, 2);
delay(1000);
}
}
}