Microbit UART

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
gowelding1
Posts: 2
Joined: Fri Sep 02, 2016 4:22 pm

Microbit UART

Post by gowelding1 » Mon Oct 17, 2016 9:04 am

I am trying to get the microbit to talk to other devices so I need to create tx and rx on the GPIO pins. I am trying to use this function but no matter how I arrange it, including deleting “microbit.”, all I get are syntax errors. Has anybody got an example of how this command should be written?
microbit.uart.init(baudrate=9600, bits=8, parity=None, stop=1, *, tx=None, rx=None)

According to the instructions the following command must be executed before the program terminates to restore the python console. ``uart.init(115200)’’. What happens if your program crashes and can't get to this command does your microbit become un-programmable, a bin job?

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Microbit UART

Post by deshipu » Mon Oct 17, 2016 1:43 pm

It's extremely difficult to damage the micro:bit. When you change the settings of your UART, it will simply work with those settings from that moment. I suppose the recommendation is there so that you can still have your REPL working, for debugging and error messages.

rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

Re: Microbit UART

Post by rhubarbdog » Mon Nov 13, 2017 8:25 pm

Code: Select all

microbit.uart.init(baudrate=9600, bits=8, parity=None, stop=1, *, tx=pin0, rx=pin1)

Post Reply