I'm trying to see if machine is working or not. I made a circuit to see current on the cable but sometimes I see 'OFF' on the screen even machine does not stop. I decided to change code instead of the circuit. So I want to see 'ON' on the screen if there is 'ON' for once in the last 5 status.
My code is like below:
prev_Status = None
while True:
if sensor > 1.60:
Status = 'ON'
else:
Status = 'OFF'
if Status != prev_Status:
print("Status : {}".format(Status))
prev_Status = Status
Aucun commentaire:
Enregistrer un commentaire