How would I write the code so if I recieve 'hello' it runs a function?
import serial
ser = serial.Serial(port='/dev/tty.usbmodem11201',baudrate=9600)
while True:
value= ser.readline()
valueInString=str(value, 'UTF-8')
print(valueInString)
if ser.is_open == hello:
print("Hi")
This is what I saw to do but it did not work. How would I get it to work? Thanks!
print("Hi")line with the function call. And in the if condition, I think you meant"hello"in quotes.