@@ -10,17 +10,19 @@ a serial interface.
10
10
Functions
11
11
=========
12
12
13
- .. method :: init(baudrate=9600, bits=8, parity=None, stop=1, pins =None)
13
+ .. method :: init(baudrate=9600, bits=8, parity=None, stop=1, \*, tx=None, rx =None)
14
14
15
15
Initialize serial communication with the specified parameters on the
16
- specified ``pins `` . Note that for correct communication, the parameters
16
+ specified ``tx `` and `` rx `` pins . Note that for correct communication, the parameters
17
17
have to be the same on both communicating devices.
18
18
19
19
.. warning ::
20
20
21
- Initializing the UART will cause the Python console on USB to become
22
- unaccessible, as it uses the same hardware. There is currently no way
23
- to bring the console back, without restarting the module.
21
+ Initializing the UART on external pins will cause the Python console on
22
+ USB to become unaccessible, as it uses the same hardware. To bring the
23
+ console back you must reinitialize the UART without passing anything for
24
+ ``tx'' or ``rx'' (or passing ``None'' to these arguments). This means
25
+ that calling ``uart.init(115200)'' is enough to restore the Python console.
24
26
25
27
The ``baudrate `` defines the speed of communication. Common baud
26
28
rates include:
@@ -39,10 +41,10 @@ Functions
39
41
The ``stop `` parameter tells the number of stop bits, and has to be 1 for
40
42
this board.
41
43
42
- If no `` pins `` are specified, `` microbit.pin0 `` is used as the TX pin, and
43
- `` microbit.pin1 `` as the RX pin. You can also specify which pins you want
44
- by passing a tuple of two pins as `` pins ``, the first one being TX, and the
45
- second one, RX .
44
+ If `` tx `` and `` rx `` are not specified then the internal USB-UART TX/RX pins
45
+ are used which connect to the USB serial convertor on the micro:bit, thus
46
+ connecting the UART to your PC. You can specify any other pins you want by
47
+ passing the desired pin objects to the `` tx `` and `` rx `` parameters .
46
48
47
49
.. note ::
48
50
0 commit comments