LED 螢幕

The BBC micro:bit LED 螢幕包含25個紅色 LED 以5x5矩陣方式排列 (5 LEDs across by 5 LEDs down).

BBC micro:bit with all 25 LEDs lit

 

那一個 LED?

你可以使用 x , y 座標指定某一個 LED; x 為水平位置而 y 為垂直位置 (0, 1, 2, 3, 4)。 為了找出 x, y 座標,平放你的 micro:bit,如同信用卡一樣 (參考上圖)。

列出5x5矩陣 LED 的 x, y 座標:

0, 0 1, 0 2, 0 3, 0 4, 0

0, 1 1, 1 2, 1 3, 1 4, 1

0, 2 1, 2 2, 2 3, 2 4, 2

0, 3 1, 3 2, 3 3, 3 4, 3

0, 4 1, 4 2, 4 3, 4 4, 4

The x, y coordinates for the LED in the centre of the grid are 2, 2. Starting from 0, 0 count over 2 columns and then down 2 rows.

Row, column - 1

Since the row and column numbers start at 0, an easy way to figure out the x, y coordinates is to subtract 1 from the row and column number (when counting from 1). In other words, to specify the LED in the 4th column 5th row, subtract 1 from each number to get coordinates 3, 4.

使用 LED

MakeCode 編輯器

切換 LED 開關

Use plot and unplot to turn an LED on or off.

LED 是開或者關?

點的狀態函式來檢查 LED 燈是不是開著。

顯示圖示、字串和數字

除了像上面那樣單獨的開關 LED 燈,你還可以直接在畫面顯示圖像數字文字

Python

See the images section of the documentation to learn more about programming the LEDs in Python for micro:bit.

Selecting this opens external content from our support system, which adheres to their privacy policy.