#!/usr/bin/python3
import time
import serial
print("UART Demonstration Program")
print("NVIDIA Jetson Nano Developer Kit")
serial_port = serial.Serial(
port="/dev/ttyTHS1", #这里注意一下这个端口号
baudrate=115200,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
)
with open(r"t.txt",'r',encoding = 'utf8' ) as f:
c = f.read()
print(c)
serial_port.write(c.encode('utf-8'))
# c = '1lrlfrblflrrbrrllblbffllblfrrlffrllblbffllblff2'
# serial_port.write(c.encode('utf-8'))