Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python serial sending character in loop
import serial
import time
def main():
ser = serial.Serial('/dev/ttyUSB0', 230400, timeout=1)
print(ser.name)
count = 0
while True:
ser.write(b'A')
print('The count is:', count)
count = count + 1
time.sleep(1)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment