Created
January 7, 2019 14:34
-
-
Save BbsonLin/bddb808906e4fa3c527d8f15bec1f2f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 threading | |
import sys | |
import signal | |
import time | |
def quit(signum, frame): | |
print('') | |
print('stop fuction') | |
sys.exit() | |
if __name__ == "__main__": | |
ser = serial.Serial('/dev/ttymxc1', 9600, timeout=10) | |
signal.signal(signal.SIGINT, quit) | |
signal.signal(signal.SIGTERM, quit) | |
while True: | |
ser.write(b'~\xa0\x1f\x00\xbf~') | |
resp = ser.read(16) | |
print(resp) | |
time.sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment