And that is exactly what I am trying to do. I am trying to reset a counter. This counter is based off a relay on a digital pin. When the relay is triggered via the app, it starts counting. As I explained in my first post, I have a pump that will always be putting out 4 gallons per minute. I have made counters for hour meters for the pump, an air compressor, as well as a season long hour meter.
I also have counters to count the amount of water used each time watering, as well as the amount of hours that the pump has been on. These counters are all blynk timers with different intervals.
My question is in regards to resetting the counters. My code references virtual pin 30 and 31. On the app, I have two buttons that are tied to V30 and V31. I want to be able to reset these two counters by pushing the button and holding for 1 second, so that I dont accidentally hit the button and reset it.
to the best of my understanding, this code should run the function every 1 second, and if it see the button is pushed (variable tied to virtual pin = 1,) then it will set the variable attached to the counter to go to 0 using an if function. If the button is not pushed, it says to write the variable that’s stored.
I have tried not putting this code inside my reset function but its not reading the button as high or low but rather just reading the number of the virtual pin. I set it up to just print to serial monitor what it was receiving from BLYNK_WRITE.
This is my updated code for just the reset. I removed the blynk timer. Is there a way that i could require a 2 second press of the button to reset?
g = param.asInt(); /
if ( g == 1)
h = param.asInt(); /
if ( h == HIGH)