Smart and Autonomous parking.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
597 B

#!/usr/bin/env python
import time
import serial
ser = serial.Serial(
port='/dev/ttyACM0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
park_status = ser.readline()
try:
if park_status != prev_status:
if b'1' in park_status:
print("parking reserved.\n")
elif b'0' in park_status:
print("parking not reserved.\n")
except NameError:
print("**Not already prev variable.\n")
prev_status = park_status