Skip to main content

Example: Dual D-Pad Controller Test - Simple Version 手機藍芽搖桿控制測試簡單版 - #microbit #bluetooth



Example: Dual D-Pad Controller Test - Simple Version 手機藍芽搖桿控制測試簡單版
#microbit #bluetooth




Description 說明:

配合手機使用 "micro:bit Blue" APP 的  "Dual D-Pad Controller"
可以控制 micro:bit顯示 按下按鈕對應的圖形



Step 步驟:

1, Install "micro:bit Blue" APP to smartphone(Android Only).
    Android 手機安裝 "micro:bit Blue" APP

2. Write code by MAKECODE and update firmware to  micro:bit board.
    用 MAKECODE 寫程式並燒錄到板子上。

3. Pair Bluetooth with micro:bit board.
   將手機和 micro:bit board 藍芽配對

4. Launch "micro:bit Blue" APP
    開啟 "micro:bit Blue" APP。

5. Press "FIND PAIRED BBS MICRO-BITS" button on bottom side. 
    按下下方  "FIND PAIRED BBS MICRO-BITS" 按鈕。

6. Select "Dual D-Pad Controller"
    選擇 "Dual D-Pad Controller"。

7. Press button, and button symbol will show on micro:bit led matrix.
    按下手機上控制器的按鈕,micro:bit 板子會顯示按下按鈕對應的圖形。












MAKECODE 






Bluetooth_DPAD_Test_Simple
control.onEvent(EventBusSource.MES_DPAD_CONTROLLER_ID, EventBusValue.MICROBIT_EVT_ANY, () => {
  if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_A_DOWN) {
      basic.showArrow(ArrowNames.North,0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_B_DOWN) {
      basic.showArrow(ArrowNames.South, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_C_DOWN) {
      basic.showArrow(ArrowNames.West, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_D_DOWN) {
      basic.showArrow(ArrowNames.East, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_1_DOWN) {
      basic.showIcon(IconNames.Triangle, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_2_DOWN) {
      basic.showIcon(IconNames.No, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_3_DOWN) {
      basic.showIcon(IconNames.Square, 0)
  } else if (control.eventValue() == EventBusValue.MES_DPAD_BUTTON_4_DOWN) {
      basic.showLeds(`
          . # # # .
          # . . . #
          # . . . #
          # . . . #
          . # # # .
          `, 0)
  } else {
      basic.showLeds(`
          . . . . .
          . . . . .
          . . # . .
          . . . . .
          . . . . .
          `)
  }
})
basic.showIcon(IconNames.Heart)
basic.forever(() => {
   
})


Comments

Popular posts from this blog

KSB037 Motor Board 馬達板擴充積木

KSB037 Motor Board 馬達板擴充積木 key: makeblock,microbit,motor Description 說明: 使用 KSB037 Motor Board 馬達板擴充積木 https://github.com/edisonchiu/pxt-motor-KSB037 History v0.1 來源版本 https://github.com/lioujj/KSB037 v0.2 修正字串錯誤 Step 步驟: 1. Makeblock -> Advanced -> Add Package 2. 在 Search or enter project URL… 輸入擴充積木網址,      https://github.com/edisonchiu/pxt-motor-KSB037 3. 按下搜尋會出現擴充積木,按下去新增擴充積木 4. 積木區就會出現新的積木可以用了。 KSB037 馬達擴充板 擴充積木測試程式 KSB037_CustomBlock_Test 目的說明: 按下按鈕可以測試馬達和板子是否正常運作 注意事項: 馬達擴充板 外接馬達需要外接電源,且電源開關需要開啟。 馬達擴充板 指撥開關 2,3,4,5 需要在 ON 的狀態。 功能說明: 按 A 左邊馬達往前全速(1023)運轉。 按 B 右邊馬達往前全速(1023)運轉。 按 A+B 兩邊邊馬達同時往前全速(1023)運轉。 以上皆非則馬達停止顯示中心一個點。 micro:bit - KSB037 Motor Simple Test (JavaScript) Source Code 源碼如下:

micro:bit resource and reference 相關資源與列表

micro:bit resource and reference 相關資源與列表 micro:bit,micro,bit,resource,reference ,website,list,資源,列表 Protol入口網站 Micro:bit Educational Foundation | micro:bit http://microbit.org/ The Micro:bit Foundation is a global non-profit organisation making invention with technology fun for everyone! micro:bit官方主要網站入口。下面列有中文的入口網站,不過中文化程度不高, 只有首頁是中文,連結後的網頁都是英文。 Micro:bit Foundation (香港繁體) http://microbit.org/hk/ Micro:bit Foundation (中國簡體) http://microbit.org/zh-CN/ Hardware Resoures 硬體介紹與資源 BBC micro:bit | Mbed https://os.mbed.com/platforms/Microbit/ Mbed 上關於 micro:bit 的資料,有很詳細 microbit mbed c++ 的教學以及資源。 micro:bit Schematics http://tech.microbit.org/hardware/schematic/ micro:bit Hardware/IC/Circuit 硬體電路介紹,零組件的Specification規格。 micro:bit Reference Design http://tech.microbit.org/hardware/reference-design/ Design Circuit Schematics Gerber BOM 線路設計、線路圖資源介紹與連結。 BBC micro:bit Circuit Schematics on GitHub microbit-foundation/microbit-reference-design: m...

Maze - Blockly Games

Blockly Games : Maze 1 Question 問題: Solution 解答: moveForward(); moveForward(); Blockly Games : Maze 2 Question 問題: Solution 解答: moveForward(); turnLeft(); moveForward(); turnRight(); moveForward(); Blockly Games : Maze 3 Question 問題: Solution 解答: while (notDone()) {   moveForward(); } Blockly Games : Maze 4 Question 問題: Solution 解答: while (notDone()) {   moveForward();   turnLeft();   moveForward();   turnRight(); } Blockly Games : Maze 5 Question 問題: Solution 解答: moveForward(); moveForward(); turnLeft(); while (notDone()) {   moveForward(); } Blockly Games : Maze 6 Question 問題: Solution 解答: while (notDone()) {   moveForward();   if (isPathLeft()) {     turnLeft();   } } Blockly Games : Maze 7 Question 問題: Solution 解答: ...