Python 動手做「Micro:bit」Unit 1:點亮 LED
本篇文章會使用Mu Code Editor來開發micro:bit的應用程式,Mu Code Editor是一個給Python初學者的撰寫Python程式碼的軟體工具,此軟體的操作方式可參考Mu Code Editor官方的教學文章:https://codewith.mu/en/tutorials/。
LED的原理與應用(Behind the MakeCode Hardware - LEDs on micro:bit)
Micro:bit 用 25顆的 LEDs 來顯示一些圖形,例如愛心、笑臉等。
LED的原理與應用(Behind the MakeCode Hardware - LEDs on micro:bit)
Micro:bit 用 25顆的 LEDs 來顯示一些圖形,例如愛心、笑臉等。
第一個範例就使用micro:bit線上 Python Editor 的範例。程式碼如下:
1 2 3 4 5 6 7 | # Write your code here :-) from microbit import * while True: display.scroll('Hello, World!') display.show(Image.HEART) sleep(2000) |
範例結果影片:
此外https://makecode.microbit.org/ 裡的tutorials也有提供 Python 的自學課程,例如點選 Flashing Heart ,再點選 Python 後,就可以練習用 Python 來做閃爍的愛心了。
若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。
If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.


留言