0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

micro:bitで8x8のNeopixelを使う+光らせる色を数字で指定する

Posted at

概要

micro:bitで8x8のNeopixelを使ってみました。
また、指定した位置のNeopixelの色を簡単に指定する方法についてもまとめました。

製品

こちらのネオピクセルを8x8=64個敷き詰めたものを使いました
https://amzn.to/4mCtH7K

image.png

動作動画

サンプルプログラム概要

stripで64個のNeopixelが定義され、通常はそこに対して色を指定します。
レインボーにしてみたり全体を同じ色で光らせたり。
今回は棒グラフのように色が積みあがるサンプルプログラムにしました。

1段ごとのNeopixelの位置をStrip内のrangeで指定しています。

指定したRangeの色の指定ですがシンプルに赤青などの色を1,2などで指定できるかと思ったのですが、
下記のブロックを数字に置き換えてもうまく動きません。

image.png

こちらのRGBで指定する方法もありますが、ちょっと手間がかかります。
image.png

試行錯誤の結果このレインボーパターンのブロックを利用することにしました。
image.png

通常はstriptを1-360にして全体をレインボーパターンにするものですが、その一部だけを指定し、1段ごとの色に設定しました。

サンプルプログラム

microbit-画面コピー.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?