<reponame>whittinghama/comp3215<filename>webserver-v3/serialtest.py
import time
import serial

# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
	port= 'COM9',
	baudrate=9600,
	parity=serial.PARITY_ODD,
	stopbits=serial.STOPBITS_TWO,
	bytesize=serial.SEVENBITS
)

ser.open()
ser.isOpen()
ser.write(1)
out = ''
# let's wait one second before reading output (let's give device time to answer)
time.sleep(1)
while ser.inWaiting() > 0:
	out += ser.read(1)
	
if out != '':
	print ">>" + out
ser.close()