Created
June 9, 2018 21:01
-
-
Save rwoloszyn/861e2f6a80efcc5e9597f4f32bfd8ba7 to your computer and use it in GitHub Desktop.
Python serial sending character in loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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