Commit b45434e3 authored by Ján Labuda's avatar Ján Labuda
Browse files

feat: script for communication

parent 78977b04
......@@ -58,3 +58,6 @@
!*.tcl
# End of https://www.toptal.com/developers/gitignore/api/alteraquartusii
# scripts
!*.py
import serial
import serial.tools.list_ports as ports
def sendAF(port):
ser = serial.Serial(port, 115200)
num = 0xAF
packet = bytearray([num])
ser.write(packet)
ser.close()
def readBlock(port, n):
ser = serial.Serial(port, 115200)
for _ in range(n):
num = ser.read()
print(num.hex())
ser.close()
if __name__ == '__main__':
print(list(map(lambda x: x.device, ports.comports())))
#sendAF('COM3')
readBlock('COM3', 5)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment