Android app reset button

Hello guys :blush:
I need some help in my app build.
So, I use the app to count turns of a potentiometer using an ESP32 module and Wi-Fi.
I made it to display the values very well, but I need the app to do one more thing for me.
I need an restart button, so when I hit the restart button it gets the reading value and subtracts it so it starts from 0.
Example :
It shows 250, when I press restart then it will subtract 250 from the Wi-Fi input data, and start again from 0 (250-250,251-250,252-250) .
Huge thanks for everyone willing to help me.
I would be very thankful if you could sent me the blocks right away.

What have you tried so far?

I have found the solution before 5mins hahaha, just used seperate labels and some tiny code.
Thanks anyways.

You will need to keep a global variable, LastReading, with the last raw data reading.

You also need to keep a calibration value, in TinyDB if you don't want to have to recalibrate each run.

Call the variable zeroPoint, or use that tag in TinyDB.

When a new data value arrives, store it in LastReading, and display LastReading - zeroPoint.

When the calibrate button is clicked, set zeroPoint to lastreading, and save zeropoint in TinyDB.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.