Linking HTML program to Python using Bolt

Hello I am working on a project where I have a HTML webpage running as a product on Bolt cloud and a python program running in a digitalocean server. Suppose I have a webpage (deployed to Bolt) which has ON & OFF button which will turn on/off LED connected to pin say pin ‘0’. Is there any way I can detect this on/off switching in my python program running in digitalocean server?

Yes,you can detect this switching in your python program using the digitalWrite() function
if (digitalWrite(“0”,“HIGH”)):
print(“The LED is ON”)
elif (digitalWrite(“0”,“LOW”)):
print(“The LED is OFF”)

@palash.w999 Thanks for the reply but my question was not about how to switch on/off LED using python. I have this product deployed to bolt for ex:

When I open the bolt app or I click on ‘view this device’, the webpage is displayed with the two buttons ON & OFF.

When I click ON bolt runs digitalWrite(0,‘HIGH’) and similarly for OFF.

My question , is there a way I can know or read that bolt has turned ON the led, from my python program running in a server? I cannot use digtalRead on the same pin. So is there any other way ?

I don’t think there is any way to check that from your python server because there is no such function(as of now)to link your python code running on your server to the HTML program u have created on the bolt cloud.Python is generally used as a server side/back end language in HTML.


You can get to know whether the command was successful or not by the response of the python command/web api call.

If the response returns success as 1 then the command was successful. If 0, you can check the message so as to know the reason for failure.