HackMD
  • Prime
    Prime  Full-text search on all paid plans
    Search anywhere and reach everything in a Workspace with Prime plan.
    Got it
      • Create new note
      • Create a note from template
    • Prime  Full-text search on all paid plans
      Prime  Full-text search on all paid plans
      Search anywhere and reach everything in a Workspace with Prime plan.
      Got it
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Micro:bitでセンサーをつかってみよう ## Micro:bitをはじめよう 1個あればとりあえずひとりで楽しめます。 表側の左上青色の部分はものによって違う色ですが、飾りなので色によって機能が違うということはありません。選べないので何色が買えるかは運次第です。 ### 機能の概要 micro:bitは次にあげるハードウェア機能を備えています。 1. 個々にプログラムできる25個のLED 1. プログラム可能な2個のボタン 1. 物理的に接続するための端子 1. 光と 温度のセンサー 1. 動きセンサー (加速度計とコンパス) 1. 無線機とBluetoothを通した無線通信 1. USBインターフェース https://microbit.org/ja/guide/features/ PCとはUSBケーブルで接続します。 **タブレット、スマートフォンでもMicro:biit用のアプリケーションと、bluetooth接続でデータのやりとりができますが、個体差が大きいです** ### micro:bit用電池ボックス/モジュール USBケーブルで給電された状態でも動きますが、以下のものがあると便利です。 * 電池ボックス キットで購入すると付属品に入っています。 * バングルモジュールキット ボタン電池で動きます。スピーカもついています。 * 電池モジュールキット ちょっと高いですが、単4電池3本で動かせます ## MakeCodeの使い方 ### ブラウザ(chromeを推奨)でひらく ウェブブラウザを起動したら、micro:bitのウェブサイトを開きます。 https://microbit.org/ja オレンジ色の[プログラムしましょう]ボタンをクリックすると、プログラミングのための「ホーム」画面が表示されます。 直接このURL https://makecode.microbit.org/ を表示すると、同じように「ホーム」画面が表示されます。 ### 画面の説明 ![](https://i.imgur.com/LjKrFP6.png) #### プログラムを組むエリア * ここにプログラムのブロックを置いてプログラミングします。 #### ブロック置き場 * プログラムのパーツであるブロックが置かれています。 * 種類別に格納されていて、それぞれの項目にたくさんのブロックが入っています。 #### プログラムエリアの操作 * [作業を元に戻す]・[元に戻した作業のやり直し][エリアの拡大表示]・[縮小表示]ができます。 #### シミュレータ * 作ったプログラムを画面内で擬似的に実行して、動きを確認することができます。 * micro:bit本体画像内のAボタン、Bボタンを実際にクリックで押して反応を確認できます。 * また、下のグレーのボタン類では、[停止する][再起動する][スローモーション][音を消す][全画面表示]ができます。 #### ブロック/JavaScriptの切り替え * 子ども向けにブロック型のビジュアルプログラミングの[ブロック]が選ばれています。 * [JavaScript]に切り替えることができます。 #### プログラムをダウンロードして書き込む * ダウンロードボタンで直接書き込みも可能です。 * **最新のファームウェア、webusbに対応したchromeが必要です。** https://microbit.org/ja/guide/firmware/ #### つくったプログラムは? * 作ったプログラムは、自動的にウェブブラウザが記憶します。 * 次回も同じパソコンと同じブラウザを使えば、続きからできます。 ![](https://i.imgur.com/ZNM7F4w.png) ### 言語が選べますが… * 設定から言語が選択できます。ただ、英語の方が楽かもしれません... ### レファレンス、Blockの機能 * 日本語・英語混在ですが...公式がいちばんわかりやすいです。 https://makecode.microbit.org/reference #### 「拡張」で機能の追加 * Groveなどは「拡張」からweb経由で追加できます。 ## シュミレータ・実機であそんでみる * 光センサ https://makecode.microbit.org/_fp64eoHgTEHR * 加速度センサ https://makecode.microbit.org/_Ffk79r9YFWdX * デジタル・コンパス https://makecode.microbit.org/_9pcXh0V1Y9HA * 温度センサ https://makecode.microbit.org/_9pcXh0V1Y9HA * タッチセンサ https://makecode.microbit.org/_hRJhv5719Xmb ### シリアル通信 * レファレンス https://makecode.microbit.org/reference/serial * demo code https://makecode.microbit.org/_hRJhv5719Xmb ### 無線 * demo code1 送信側 https://makecode.microbit.org/_EWs5Dz5TYD4f * demo code2 受信側 https://makecode.microbit.org/_EWs5Dz5TYD4f ## Grove Inventor kit for Micro:bit micro:bit用のGROVEモジュールのキットです。 https://www.switch-science.com/catalog/3389/ micro:bit用GROVEシールドを使うことで、センサやディスプレイ、アクチュエータなど多くのGROVEモジュールをmicro:bitと共に使用できるようになります。 電気やコーディングの知識がほとんどなくても扱え、GROVEを使用することではんだづけやワイヤーの引き回しの必要がなくなり、プロトタイピングがより便利になります。 10個のGROVEモジュールがパッケージされており、距離を測定して表示したり、身振りによって異なる音楽を演奏させたりなど、段階的に学習できる12のプロジェクトが用意されています。 * micro:bit用GROVEシールド * GROVE - ボリューム(パネルタイプ) * GROVE - スピーカー (アンプ内蔵) * GROVE - 超音波距離センサモジュール * GROVE - 光センサ v1.2 * GROVE - ジェスチャー * GROVE - 7セグメント4桁ディスプレイ * GROVE - LED 赤 * GROVE - WS2812 Waterproof LED Strip - 30 LEDs 1m * microUSBケーブル * プロジェクトマニュアル(英語) https://github.com/SeeedDocument/Bazzar_Attachment/raw/master/110060762/Grove%20inventor%20kit%20for%20microbit%20user%20manual.pdf * ワニ口ケーブル × 10 * GROVE ケーブル × 7 --- ### demo code -簡単なものだけ、ちょっとご紹介します- 2.Sunshine micro:bit (光センサ) https://makecode.microbit.org/_bdx5zhJ0CRwb 3.LED Bar Control (半固定抵抗) https://makecode.microbit.org/_9Tb9sm9DhAmu 4.Music Player https://makecode.microbit.org/_HiiDEeTrT7JK --- ## lamp:bit https://www.switch-science.com/catalog/5397/ micro:bitで街路灯をシミュレートしたした拡張基板 **makecodeの「拡張」からlamp:bitを検索** >STOP:bitの姉妹品です。micro:bitをボルト及びワニ口クリップで接続できる仕様になっていて、街灯を形態と機能の両面で再現するように設計されています。 > ![](https://i.imgur.com/wQXMOgM.jpg) >周囲の環境の光量に応じて自動的に白色LEDをオン/オフできるフォトトランジスタを搭載しています。電源は、接続されたmicro:bitの0 Vと3 Vピンを通じて供給されます。 > >拡張エディタとしてMakeCode Editor用のカスタムコードブロックが用意されています。 STOP:bitと組み合わせて、交通網や輸送などの大きなプロジェクトにも活用できます。 --- ### demo code deadbandの値が設定できます。おそらくちらつき、不安定動作の防止ですが。 https://makecode.microbit.org/_PykUEmULwCmz --- ## Stop:bit https://www.switch-science.com/catalog/4031/ micro:bitで信号機をシュミレートするための拡張基板です。 **makecodeの「拡張」からstop:bitを検索** 交通信号/歩行者横断のプロトタイプ開発のプロジェクトから発展した製品です。 ![](https://i.imgur.com/huEThbH.jpg) >信号機の物理的特性から設計され、コントローラーとしてmicro:bitを利用します。 >直径10 mmのLEDが三つ搭載され、各々をmicro:bit I/Oピン一つずつから駆動し、電源もmicro:bitから供給します。 >より大きな規模を想定している場合でも、micro:bitに搭載の無線モジュールによる通信を活用することができ、町や都市の交通網を管理/調査する用途などに最適です。 >MakeCodeエディタにカスタムブロックを追加することでコーディング作業を簡素化することが可能ですが、「digital write pin」ブロックを使用することもできます。 > ### demo code * ステータス(traffic Light state)のBlockをつかったサンプル https://makecode.microbit.org/_0qJTD9XC9cEC * 常時青信号が点灯 * Aボタンで赤信号>もういちど押すと青信号 * Bボタンで黄色>もういちど押すと青信号 https://makecode.microbit.org/_RFkViceb5f7o

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in via Google

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully