This is indeed exactly my setup! Thanks for the clarification!
In the Client (browser), i will copy 3 values to the Raspberry pi:
- direction: direction of the motor
- speed: speed of the turning of the motor
- motor_aan: motor is running, depending on the status of the checked box in the Client.
Anvil clone: https://anvil.works/build#clone:VSGEZTAQUOND5YB5=IOL5IX3QLBD7G6UFTUTSGHOH
In the Raspberry Pi, the following function will we executed, because this is called by the Client:
The for-loop will start when the checkbox is checked in the Client.
Let’s say this for-loop last for 20 min. After 10 min, you encounter a problem and you want to stop the motor. So my first reaction will be: uncheck the checkbox in the Client:
So at the end of the for-loop,I want to call for the status of this checkbox:
if the checkbox is checked, continue with the for-loop, if not checked: break.
So I have to make a call from the Raspberry Pi --> the Client! And this is the problem I think. Is it possible to call the Client and ask for the status of the checkbox ‘Motor AAN’ at that moment?
If not, I was trying this:
I thought this might work: Raspberry Pi --> Server (Anvil) --> Client (Webbrowser)
I saw this in one of your comments on the forum: Calling user input in the server
For testing, I made a new checkbox in my Client:
If this is pressed,this will happen:
And this will be executed on the Anvil server:
In the Raspberry Pi, I will implement this code:
Afterwards, I get this message:
I guess it’s because this is not yet executed in the Client:
But I’m not really sure if it’s possible to make a call from the Raspberry Pi to the Client. That’s why I wanted to ask first if this a good path or I should change it up and install a physicall button on my Raspberry Pi that acts as ‘an emergency button’. It is not ideal, because in this way, you cannot turn off your motor using a web application, which is really cool.
In the end, I just want to start and stop the motor with the website.
Hope this makes things a bit clearer. Sorry for the miscommunication. It’s my first time using a server-client, so it’s all a bit new to me. And it makes it all more complicated, if you add a third player (Raspberry Pi)!