LoginSignup
4
5

More than 5 years have passed since last update.

microbit > Grove Shield

Posted at

micro:bit用Grove Shield

Grove Shield for micro:bit - Other for Development Platforms - Seeed Studio

はじめてのコンピュータサイエンス - Microsoft MakeCode

スクリーンショット 2018-01-31 13.27.57.png

makecode.microbit.org

関数一覧

https://github.com/Seeed-Studio/pxt-grove/blob/master/main.ts
pxt-grove/main.ts at master · Seeed-Studio/pxt-grove · GitHub

できること

LEDコントロール
ジェスチャセンサ
4桁ディスプレイの制御
ロータリースイッチ
距離センサ
ライトセンサ
LEDテープの制御(WS2812)

Grove参照の追加

高度なブロック

スクリーンショット 2018-01-31 12.59.49.png

パッケージを追加する。

スクリーンショット 2018-01-31 13.00.07.png

検索BOXにgroveと入力して検索
表示されたgroveを選択する。(ダブルクリック)

スクリーンショット 2018-01-31 13.00.57.png

今までなかった部分(計算の下側)にGROVEが作成されている。

スクリーンショット 2018-01-31 13.02.23.png

Shakeカウンター

Steps

  1. Add basic block on start, then add variable block set item to 0, rename ‘item’ to ‘Display’. If you have added the Grove Package successfully, add block 4-Digit Display at (P0) and (P14).

  2. Add input block on shake, then add variable block change item by 1,rename ‘item’ to ‘N’.

  3. Add block item show number from Grove Package, rename ‘item’ to ‘Display’, replace ‘0’ with variable block ‘N’.

  4. Add basic block pause (ms) (100).

  5. Hardware connection: Connect the Grove – 4-Digital Display to P0 port of Grove shield for micro:bit.

  6. Click Download to transfer your code in your micro:bit.

  7. Shake the micro:bit and you will find the number raises by 1 every time your shake the board.

screen shot

スクリーンショット 2018-01-31 13.19.41.png

JS code

let N = 0
let Display: grove.TM1637 = null
input.onGesture(Gesture.Shake, () => {
    N += 1
    Display.show(N)
    basic.pause(100)
})
Display = grove.createDisplay(DigitalPin.P0, DigitalPin.P14)

接続と実行

IMG_7039.jpg

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5