How do you read and write in thingspeak to control actuator manual or auto?

hello, I'm just learning about MIT App Inventor. I want to make an application to monitor sensor data and control actuators using the application from MIT App Inventor. The microcontroller used is ESP32 and uses Thingspeak. in this application, I want control to be done manually when pressing a button. If you don't press it, it will continue to run automatically to avoid conflicts. can you help? Thank You

This has two samples.

its from andre castro and sunak?
im sorry, im so dont undrestand about it

in your example send and get data are manually with button. how about in get data always auto update without button get data. are with create 2 channel can solve the problem? channel 1to monitoring and channel 2 to control. thanks

Pull in a Clock from the Sensors Drawer and use its Timer.

i just try from many source and i get this from my program. can you check it? thanks

coba.aia (6.9 KB)

The Web2 PostText requests you are invoking should have a Web2 event block that catches the response that arrives in response to that PostText.
(I forget which event block. Check the tool tip for the PostText block.)

You need that to provide feedback for those buttons.

Here is the text responseContent you got, as seen in a Do It of global data (worst possible name for a variable):

Do It Result:
"{"channel":{"id":2574094,"name":"Monitoring","latitude":"0.0","longitude":"0.0","field1":"Suhu Udara","field2":"Kelembapan Udara","field3":"Sensor LDR","field4":"Sensor PIR","field5":"Kelembapan Tanah","created_at":"2024-06-10T15:02:35Z","updated_at":"2024-06-12T06:16:10Z","last_entry_id":1105},"feeds":[{"created_at":"2024-07-28T08:35:34Z","entry_id":1105,"field1":"30.80","field2":"62.00","field3":"1","field4":"0","field5":"100.00"}]}"

Here's proper parsing:
image


coba (1).aia (7.8 KB)

I did not address what you send in the PostText from your buttons, which is almost certainly wrong, given the variable names feeding them.

im sorry for that worst variable name. i just make 3-4 project to try make the app and the channel for thingspeak

so web1 is for monitoring, and web2 for control right?

That's a reasonable use of them.

It keeps the monitoring logic separate from the control logic.

i got error like this while trying to click button off or on

If the URL is not valid, show it using the Do It facility.

coba_1.aia (7.7 KB)
this my project after ad web2 url

What is the URL going into the Web2 Post?
What is the data going into it?


this picture are condition after click pff switch manual. button can`t click


this condition after click on switch manual


are first screen condition

web2 go to channel2 to control actuator and data sensor to channel1 to monitoring. in the app data sensor will show

Does that look reasonable to you?

my bad.. i think not. because that link must contain channel2 to control. i think the field must 0 and 1