pikapython/examples/Device/UART_CALLBACK.py
李昂 8c9dcfb618
add examples/Device/UART_CALLBACK.py.
Signed-off-by: 李昂 <liang6516@outlook.com>
2022-12-23 12:20:36 +00:00

16 lines
239 B
Python

import PikaStdDevice as std
print('hello pikascript')
uart = std.UART()
uart.setId(0)
uart.setBaudRate(115200)
uart.enable()
def cb1(signal):
print('recv:', uart.read(32))
uart.setCallBack(cb1, uart.SIGNAL_RX)
while True:
pass