初探 micro:bit | 設定micro:bit
做好準備
你可以透過提供指令的方式,決定 micro:bit 進行哪些工作。
這些指令的集合就稱為程式化 (Program
) micro:bit,而程式化的內容是透過撰寫程式碼 (code
)而成,程式碼是一種人類和電腦都可以理解的溝通語言。
例如,你可以利用線上版本的 MakeCode
積木語言,或是 Python
文字編輯器,對你的micro:bit 設計程式。
我們的 Let's code 頁面會幫助你選擇正確的開發方式。
同時你需要準備:
- 一臺可以上網,且安裝好
Google Chrome
網頁瀏覽器的電腦
或者是
- 一臺安裝好 micro:bit App 的 Android/iOS 行動裝置,例如手機、平板電腦
當你已經完成你的程式碼,接著就需要將你的 micro:bit 連接到電腦或是行動裝置,以便將程式碼傳送到 micro:bit 中執行功能。
開始燒錄程式到 micro:bit
請連接你的 micro:bit 至你的電腦或是行動裝置。
- 如果你使用的是電腦,你需要使用 micro USB 線進行連接
- 如果你使用的是手機或是平板電腦,請使用藍芽進行無線連接
透過電腦,燒錄程式到 micro:bit
傳送你的程式到 micro:bit中的動作,稱為燒錄 (flashing
),也就是將你的程式碼檔案,從電腦複製到 micro:bit 上的記憶體。
你的 micro:bit 在燒錄過程中,會暫停原本的功能運作,並且黃色LED會持續閃爍,直到程式被完全複製。
當燒錄完成後,micro:bit 會自動重新啟動,執行程式。
有兩種方法可以傳送程式碼到 micro USB 中
以下進行詳細說明:
- 從電腦的檔案管理系統燒錄程式
當你使用 micro USB 線連接電腦跟 micro:bit , micro:bit 會被視為外接儲存裝置,就像一般的 USB 隨身碟,而它的名稱會是 MICROBIT。
以 Windows 的檔案總管為例:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
接著透過編輯器,將把程式碼儲存成 .hex
檔案格式,直接複製此檔案到外接裝置中,進行燒錄的動作。
完成燒錄以後, micro:bit 會重新開機,你會看到這個外接裝置會重新連結電腦,即表示燒錄已經完成。
- 透過編輯器燒錄程式
你可以用更直接的方式,在編輯器設計完程式碼以後,就直接將檔案燒錄到 micro:bit 中。
這個方式只支援 Google Chrome 與 Microsoft Edge 瀏覽器,且必須支援 webUSB的版本。
步驟如下:
-
MakeCode 編輯器左下方,按下載鈕右方的 那三個點(…)
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
選擇 配對裝置 (Pair device)
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
確定線都連接好了,按下配對裝置 (Pair device)
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
點選你的裝置 BBC micro:bit CMSIS-DAP-已配對 ,然後再點選 連線
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
回到編輯器畫面,此時下載的圖示會變成以下圖示,表示已配對裝置
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
按 下載 ,即可進行程式燒錄
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
透過行動裝置,燒錄程式到 micro:bit
從教學實務經驗,不建議採取此方式,原因如下:
- 螢幕較小的手機,不容易進行程式設計的操作
- 整體步驟較為複雜
- 需另外安裝App跟使用無線配對裝置,不同廠牌行動裝置可能會有相容性問題
故此開發方法僅供研習參考
了解更多:使用行動裝置開發micro:bit指南