<filename>pyopencl/read_serial.py<gh_stars>0
# Importing Libraries
import serial
import time
arduino = serial.Serial(port='COM4', baudrate=9600, timeout=.1)
def write_read(x):
    arduino.write(bytes(x, 'utf-8'))
    time.sleep(0.05)
    data = arduino.readline()
    return data
while True:
    print(arduino.readline().decode('ascii'))
<filename>pyopencl/read_serial.py<gh_stars>0
# Importing Libraries
import serial
import time
arduino = serial.Serial(port='COM4', baudrate=9600, timeout=.1)
def write_read(x):
    arduino.write(bytes(x, 'utf-8'))
    time.sleep(0.05)
    data = arduino.readline()
    return data
while True:
    print(arduino.readline().decode('ascii'))
# Importing Libraries