Sending Status Updates from Arduino to App

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");

You need a Clock Timer, and Delimiter sensing:

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to

...

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