How to check if the led is on or not using python?
Type the code as given as below:-
from boltiot import Bolt
api_key = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” ///Your api key
device_id = “BOLTXXXXX” /// Your device id
mybolt = Bolt(api_key, device_id)
response = mybolt.digitalWrite(‘0’, ‘HIGH’) /// Here “High” represent “Led is on” and “Low” represent "Led is off"
Now if ‘high’ is written then led is on and for ‘low’ led is off
(Note that the connection should be properly set up)
Unfortunately due to technical limitations you can not check the current state of the pin by making a API call via python.
However you can check it programmatically by storing the last status in a variable and then using it in your further checks/decision making.