I make a project in Cisco PT. I connected the door to SBC. I want the LCD to display “Open” when the door is open, and the LCD to display “Closed” when the door is closed.
but I don’t know why door status is always 0 if I open or I close the door.
I tried this:
#pin d1 door
#pin d0 LCD
if digitalRead(1) == HIGH: #1 is door pin
customWrite(0, "OPEN")
else:
customWrite(0, "Close")
Full code
from gpio import *
pinMode(5, INPUT) #this is a switch and if it is turned on then it is supposed to check the door
pinMode(0, OUTPUT)
pinMode(1, INPUT)
while True:
if digitalRead(5) == HIGH:
if digitalRead(1) == HIGH:
customWrite(0, "Open")
else:
customWrite(0, "Closed")
New contributor
PPIN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.