Microbit_LED 可用於設定extension provides App Inventor users with the ability to programmatically change the BBC micro:bit開發板上的5x5 LED矩陣狀態,可透過程式設定各種圖案或文字。字元之間的The scrolling speed of the display may also be customized.
參考資料:
屬性BluetoothDevice – 連接至micro:bit 裝置之BluetoothLE元件。
方法WriteLEDMatrixState – 寫入micro:bit的LED矩陣狀態。LED_Matrix_State 是由五個數字所組成的清單(0~31),代表LED矩陣上各列上的哪個LED要亮起。From left to right, the values of the LEDs are 16, 8, 4, 2, 1. For example, if you want to turn on the LEDs in one row such that power states were 10011, you would send the value (16 + 2 + 1) or 19 for the row。執行完本方法之後就會呼叫WroteLEDMatrixState 事件。事件變數是由五個數字所組成的清單,每個元素代表矩陣的一列。每個數字的範圍皆為0-31,左到右的LED數值分別為16、8、4、2、1。
參數: LED_Matrix_State (清單) — 5個數字所組成的清單,分別代表LED矩陣的一列,where each value is the integer value of the bit array for the nth row of the LED matrix.
WriteLEDText – 將文字顯示於micro:bit的LED矩陣。The rate at which each character appears on the micro:bit's display depends on the last scroll value written by WriteScrollDelay . Due to the allowable length of Bluetooth low energy packets,所要發送的字串長度受限於, the strings sent are restricted to 20 or more UTF-8 octets。如果要發送長度大於20 octets的字串會使得訊息被切斷。
參數: LED_Text_Value (字串) — The text to write. Strings are limited to a length of 20 UTF-8 octets.
事件 |
|