Skip to content

Instantly share code, notes, and snippets.

@rwoloszyn
Created June 9, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwoloszyn/861e2f6a80efcc5e9597f4f32bfd8ba7 to your computer and use it in GitHub Desktop.
Save rwoloszyn/861e2f6a80efcc5e9597f4f32bfd8ba7 to your computer and use it in GitHub Desktop.
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