Status of Digital Pin

Is there any method to find whether a digital pin is at HIGH or LOW state? For example, pin 0 is HIGH or LOW?

There is no way to check if your output pin is HIGH or LOW. But you can USE flag method, to check if the pin was previously changed by you.

For example,
flag1 = 0;

digitalWrite(1,HIGH)
flag1 = 1

if (flag1 = 0):
printf(“Pin 1 is OFF”)
else:
printf(“Pin1 is ON”)

Hello,
You can use digitalRead(pin); to read status of pin 0

or

You can connect the pin 0 output to other GPIO pin as input and read the status for your pin 0 using
digitalRead(input pin);

I have written this code. But it is not working.
it says missing one positional argument ‘pin’.

Corrrection - mybolt.digitalRead(‘0’)

1 Like

@munazziliitd @sask1236
It’ll return you a HIGH when you send a 5V signal to that pin. And It’ll return a LOW when you return anything below that.

You can read the status of pin like in arduino, but with this you can’t check the status of your pin, whether your LED is ON or OFF.

Bolt IoT has introduced a new feature for the Cloud Pro users recently, with which you can pull your historic data. So, in the upcoming days, you’ll be introduced with methods and functions to check the last status of your PIN. Whether your LED was turned ON or OFF by you.