hi,i am trying to sent binary data to stm32.
here is my code:
uart = UART(1, 115200, timeout_char=1000)
uart.init(115200, bits=8, parity=None, stop=1, timeout_char=1000)
def uart_sent(reason,data_):
global uart
needtosend = struct.pack("cc",reason.to_bytes(1,byteorder='little'),data_.to_bytes(1,byteorder='little'))
uart.write(needtosend)
return
but when i called “uart_sent” function like this:
uart_sent(0x00,0xff)
I got error:
Traceback (most recent call last):
File “”, line 172, in
File “”, line 41, in uart_sent
TypeError: function doesn’t take keyword arguments
but I do the same thing in jupyter notebook to test my code:
this code can work perfectly.
forgive my poor english