Created
June 13, 2018 23:38
-
-
Save nikitachukov/7dbe0d6c1a2099181cd1603808a88c61 to your computer and use it in GitHub Desktop.
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 time | |
import serial | |
import datetime | |
ser = serial.Serial(port='/dev/ttyUSB0',baudrate=115200) | |
received = [] | |
ser.write(b'begin\n') | |
time.sleep(5) | |
start=datetime.datetime.now() | |
for i in range(1,10): | |
ser.write(b'test%i\r\n'%i) | |
time.sleep(0.01) | |
while ser.inWaiting() > 0: | |
line = ser.readline() | |
if line: | |
received.append(line.decode().strip()) | |
print(datetime.datetime.now()-start) | |
print(received) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment