Hi, I am trying to finde a way to gather statistics about the use of an “alcohol dispenser”, The surgeon need to rub his/her hands for 2 min with alcohol, to get his hands sterile.
So i made a “button” that is connected to the alcohol dispenser, when the surgeon presses the handle :
A display countdown timer, switches on, so the surgen kan keep track about the 2 minuttes.
The button is then disabled, so the counter can not be reset while it is not counting.
The number of Button pushes is counted.
When the 2 minutes is over, statistics including number of button pushes are syncronised through wifi.
I have this code :
void loop() {
buttonState = digitalRead(Button);
int count = (start_num - ((millis()/1000)- start_ms));
if (buttonState == HIGH && count > 0) {
displayNumber(count);
}
else {
// turn the display off when it finishes counting
lightNumber(10);
}
if (buttonState == HIGH && count < 0) {
delay(200);
int (start_num = Time);
start_ms = millis()/1000;
buttonPushCounter++;
}
if (buttonState == HIGH && count = 0) {
delay(200);
// the 2:00 is over => retrieve
// buttonPushcounter variable and send it through wifi
}
}code]
Unfortunatly i just cannot get the counting of my button pushes right, i guess so weird numbers in the serial monitor. I am new to programming, please any suggestion ?