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

More than 1 year has passed since last update.

SONY Spresense用フルカラーLED(WS2812C-2020)拡張ボード

Posted at

Sony Spresense用のフルカラーLED(WS2812C-2020)拡張ボードを作りました。
少し前にLEDチューブ用の無拡張ボードを作りましたが、
今回はボード上にフルカラーLED(WS2812C-2020)を3個実装した基板です。

今回作成した基板
DSC04639.JPG

Spresenseにセットしたイメージ
DSC04638.JPG

回路図
WS12C_Schematic.png

テストプログラム
今回も追加ライブラリとして
adafruit/Adafruit_NeoPixel
KotaMeiwa/nepils
を使用していますのでArduino IDEのライブラリに追加してください。
KotaMeiwa/nepils のサンプルとして付属している example
const uint16_t PIN の 番号と
const uint16_t NUM_PIXELS の個数を基板に合わせて変更しています。

example.ino
#include <SpresenseNeoPixel.h>

// const uint16_t PIN = 6;
const uint16_t PIN = 22;
const uint16_t NUM_PIXELS = 3;
SpresenseNeoPixel<PIN, NUM_PIXELS> neopixel;

void setup()
{
    Serial.begin(115200);
    neopixel.clear();
    neopixel.framerate(40); // default framerate is 40[fps]

    delay(1000);

    Serial.println("start");
}

void loop()
{
    static uint32_t prev_ms = millis();
    static uint8_t state = 0;
    if (millis() > prev_ms + 1000)
    {
        Serial.println("change color");

        switch (state)
        {
            case 0:
                neopixel.set(128, 0, 0);
                break;
            case 1:
                neopixel.set(255, 0, 0);
                break;
            case 2:
                neopixel.set(0, 128, 0);
                break;
            case 3:
                neopixel.set(0, 255, 0);
                break;
            case 4:
                neopixel.set(0, 0, 128);
                break;
            case 5:
                neopixel.set(0, 0, 255);
                break;
            case 6:
                neopixel.set(128);
                break;
            case 7:
                neopixel.set(255);
                break;
            case 8:
            default:
                neopixel.set(0, 0, 0);
                break;
        }
        state = (state + 1) % 9;
        prev_ms = millis();
    }

    neopixel.show(); // automatically control framerate to desired fps
}

今回のフルカラーLED基板はメイン基板に取り付けるタイプとして制作しました。
これから販売するための準備進めていMFKyoto2023までには販売をスタート出来るようにしたいと思っています。

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