由於各種平面的顏色與反光程度不一,單使用黑色軌跡不足以讓 mBot 順利循線前進。使用常見的「PVC絕緣膠帶」,選擇「黑」「白」兩色,以「黑白黑」或「白黑白」的交錯方式佈設,將 mBot 的循線範圍限制在外側兩線內,可適應於一般地面環境。
這裡我們嘗試運用外部感應器讓 mBot 自行走直線 (straight line),也就是利用感應器回傳的數值來修正 mBot 的行走方向。可運用的感應器有「羅盤 (compass)」、「陀螺儀 (gyroscope)」與「加速計 (accelerometer)」,三者的差異可參考「Difference between Accelerometer , Compass ,Gyros or Gyroscope」。
而「走直線」在此意味著盡可能讓 mBot 朝著初始位置 (initial position) 所指的方向前進。起初嘗試運用「電子羅盤」指引方向,但容易受到地球磁場以外的磁性物質干擾,不利於 mBot 正確找到方向。因此,選擇「陀螺儀」來偵測 mBot 車體偏移情形,及時轉向,回到初始指向的路線。
https://scratch.mit.edu/projects/205525319/
參考資源:
https://scratch.mit.edu/projects/205311495/
參考資源:
JavaScript 版本 (適合手機與行動裝置)
https://scratch.mit.edu/projects/199914174/
https://scratch.mit.edu/projects/200135871/
https://scratch.mit.edu/projects/200136851/
https://scratch.mit.edu/projects/200176510/
參考資源:
$ cp 0244_kl26z_microbit_0x8000.hex /run/media/lyshie/MAINTENANCE/
Control a BBC micro:bit from Node.js using BLE
https://github.com/sandeepmistry/node-bbc-microbit
韌體
https://github.com/sandeepmistry/node-bbc-microbit/tree/master/firmware
Golang framework for robotics, drones, and the Internet of Things (IoT)
https://github.com/hybridgroup/gobot
Scratch to micro:bit bridge.
https://github.com/MrYsLab/s2m
Linux 下使用 BLE (Bluetooth Low Energy) 與 Micro:bit 溝通
https://gist.github.com/lyshie/70c5b759357da3f630348a8a510acba9
GATT Profile 簡介
https://www.race604.com/gatt-profile-intro/
Scratch controller with Micro:bit over BLE (Bluetooth Low Energy)
Micro:bit BLE (Bluetooth Low Energy) 讀取溫度數據
Tutorial: BLE Pairing the Raspberry Pi 3 Model B with Hexiwear
$ bluetoothctl [BBC micro:bit [zotap]]# power on [BBC micro:bit [zotap]]# agent on [BBC micro:bit [zotap]]# scan on [BBC micro:bit [zotap]]# pair D6:AF:43:58:57:9F [BBC micro:bit [zotap]]# connect D6:AF:43:58:57:9F [BBC micro:bit [zotap]]# list-attributes Characteristic /org/bluez/hci0/dev_D6_AF_43_58_57_9F/service0025/char0028 e95d93ee-251d-470a-a062-fa1922dfa9a8 MicroBit LED Text [BBC micro:bit [zotap]]# select-attributes /org/bluez/hci0/dev_D6_AF_43_58_57_9F/service0025/char0028 [BBC micro:bit [zotap]]# write 0x31 0x32 0x33
透過不同「深度」的「圖層」變化,越底層的背景移動速度越慢,藉以營造出距離玩家不同遠近的視覺效果。
範例中,技巧性的藏入一白色橫條,避免移動到畫面邊界時出現延遲的問題,增進畫面的平順。
https://scratch.mit.edu/projects/193202835/
參考文件:
https://gist.github.com/lyshie/70c5b759357da3f630348a8a510acba9
參考文件