LoginSignup
2
1

More than 5 years have passed since last update.

micro:bitで踏切を作ってみる(micro:bitの光センサーとサーボモーター制御のお試し)

Last updated at Posted at 2018-03-27

概要

Railway crossing
を見て
・サーボモーターの制御
・micro:bitの光センサー
のお試しに良さそうなので実施してみました。

詳細は上記リンク先のページを読んで頂きたいのですが、ポイントは
micro:bitのLEDの部分が光センサーを兼ねている事
です。本当、よく出来たパッケージです。

動作イメージ

・プラレールを走らせたかったのですが、お試しということで置くだけに留めました
microbit_rail.gif

使用したもの

・micro:bit
・サーボモーターSG90

コード

https://makecode.microbit.org/_XKza5cA6H9RK
MCB - コピー.JPG

苦労したこと

・乾電池2つではサーボモータが動かなかった
 →USBも繋げて(電池2+USB給電)何とか動くようになった
・光センサーの閾値
→どれくらいの値をセットしたら良いか分かりにくい
  →LEDで明るさを表示させてチェック

参考にしたサイト

Railway crossing
【micro:bit】サーボモーターをコントロールする

2
1
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
2
1