micropython / pyboard

The MicroPython board
Other
518 stars 167 forks source link

uart using question #18

Closed gooyle closed 1 year ago

gooyle commented 4 years ago

hi,i‘m using usart function:uart.write(input) to send message to another pyboard,but the input must be string. Is there any other function available to send integer format data? thx very much!!!

dpgeorge commented 1 year ago

You can use the struct module to encode integers as bytes, eg: uart.write(struct.pack("<I", 1234)).