Micro:bit UART通用非同步收發傳輸器

Microbit_Uart sensor provides the ability to read from and write strings to the BBC micro:bit's serial UART port.


屬性

  • BluetoothDevice – 連接至micro:bit 裝置之BluetoothLE元件。

get Microbit_Uart1 BluetoothDevice

set Microbit_Uart1 BluetoothDevice  to


方法

  • RequestTXCharacteristic – Requests notifications of messages received from the micro:bit's serial UART。新數值會由TXCharacteristicReceived事件回傳.

call Microbit_Uart1 RequestTXCharacteristic

  • StopTXCharacteristicUpdates – 停止接收來自micro:bit的serial UART的更新。請注意可能會有來自裝置的pending messages,所以仍有可能觸發TXCharacteristicReceived事件。

call Microbit_Uart1 StopTXCharacteristicUpdates

  • WriteRXCharacteristic – 將UART_TX欄位內容寫入micro:bit。The size of the message will depend on the value of UART_TX. 所有數字都會轉為32位元整數之後發送。字串則以UTF-8編碼。Lists of objects will be sent as a sequence of bytes using the aforementioned rules for numbers and strings.

    參數:

    • UART_TX (any) — The value to transmit to the RX "pin" of the micro:bit. Strings will be encoded as UTF-8, numbers will be sent as 32-bit integers. Lists of values will be converted into be converted into a sequence of bytes depending on the type of each value in the list.

call Microbit_Uart1 WriteRXCharacteristicUART_TX


事件

  • TXCharacteristicReceived – 由micro:bit's serial UART protocol接收到任何訊息之後就會自動呼叫本事件。

    參數:

    • UART_TX_FIELD (list) — 由裝置傳來的無號位元值(unsigned byte)清單。

when Microbit_Uart1 TXCharacteristicReceived UART_TX_Field do

  • WroteRXCharacteristic – The WroteRXCharacteristic event is run after a message is written to the micro:bit via its serial UART.

    參數:

    • UART_TX_FIELD (list) — 要寫入裝置的無號位元值(unsigned byte)清單。

when Microbit_Uart1 WroteRXCharacteristic UART_TX_Field do