XIAO ESP32C6、NeoPixel8x8を表示して遊ぶ。(M5Stackなんちゃらかんちゃらで貰った)


参考
----

https://qiita.com/caa45040/items/24287bb37dfaec65dabb

https://akizukidenshi.com/catalog/default.aspx

https://akizukidenshi.com/catalog/g/g129481/

https://akizukidenshi.com/catalog/g/g112634/

https://www.switch-science.com/products/10107



いろいろ、注意
----

x 過去ログを見よ!!
x 3.2.0
x Adafruit_NeoPixel.hのインストール


目的
----

なんかのM5Stackのミーティングで貰った。
WS2812Bの8x8で遊ぶ。


結果
----

![image_original (87).jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/ea339f18-14ef-4539-9a10-3d95a59666e0.jpeg)

![image_original (88).jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/69210e4c-bc97-46af-bb05-2870173e0bac.jpeg)


プログラム
----

```c++



//NeoPixel8x8_test1_XIAO_ESP32C6_1


//インクルド
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>


//定義
#define NUM_LEDS 64
#define OUT_GPIO_NUM D10 //XIAO-ESP32C6
Adafruit_NeoPixel strip(NUM_LEDS, OUT_GPIO_NUM, NEO_GRB + NEO_KHZ800);

unsigned char Pixel[8][8][3];
int line = 7;
int column = 7;


//初期化
void setup() {

  //ネオピクセルの設定
  strip.begin();
  strip.show();

}  //main


//ネオピクセルに転送後に表示
void NeoPixe_OUT() {

  int k = 0; //RGB LEDの番号
  for (int i = 0; i < (line + 1); i++) {
    for (int j = 0; j < (column + 1); j++) {

      strip.setPixelColor(k, strip.Color(
                               Pixel[i][j][0], Pixel[i][j][1], Pixel[i][j][2]));
      k++;

    } //for j
  }   //for i

  strip.show(); //再表示

} //NeoPixe_OUT


//0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5  6  7  8  9  0  1  2  3
unsigned char hh0[8][32] = {
  {  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5 },
  {  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5 }
};

unsigned char hh1[8][32] = {
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 },
  { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }
};

//unsigned char hh3[8][32] = {
//  { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 64, 64, 64 },
//  { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }
//};


//メインループ
void loop() {

  int pt; //アドレスポイント
  for (int i = 0; i < (line + 1); i++) {
    for (int j = 0; j < (column + 1); j++) {

      pt = 3 * j;
      Pixel[i][j][0] = hh0[i][pt++];
      Pixel[i][j][1] = hh0[i][pt++];
      Pixel[i][j][2] = hh0[i][pt];

    } //for j
  }   //for i

  NeoPixe_OUT();

  delay(3000);  //3秒待つ


  for (int i = 0; i < (line + 1); i++) {
    for (int j = 0; j < (column + 1); j++) {

      pt = 3 * j;
      Pixel[i][j][0] = hh1[i][pt++];
      Pixel[i][j][1] = hh1[i][pt++];
      Pixel[i][j][2] = hh1[i][pt];

    } //for j
  }   //for i

  NeoPixe_OUT();

  delay(3000);  //3秒待つ

}  //loop


```