I am currently controlling a 3-way water valve. I have figured out how to control the valve with the app but I would like to be able to see what state the valve is currently in.
I did research but I am confused on the logic of the blocks. I created a simple block that basically shows the last output that came from the Arduino:
I would prefer to have it more user friendly where it just shows the state of the valve and how much time is remaining until the next change of state. I don't have much experience with MIT App inventor so any help is greatly appreciated.
Here is my Arduino code:
// Function to send the current status of the valve and countdown to MIT App
void sendStatusUpdate() {
String stateStr = (valveState == OPEN ? "OPEN" : "CLOSED");
BTSerial.print("Valve State: ");
BTSerial.print(stateStr);
BTSerial.print(" | Time Left: ");
BTSerial.print(countdownDuration / 60000); // Send time in minutes
BTSerial.println(" minutes");