1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5NanoC6、8x8 Puzzle Unit (Unit Puzzle ?)で遊ぶ。

Last updated at Posted at 2024-11-18

x 過去ログを見よ!!!

o_coq646.jpg



//WS2812E_8x8_VRAM_M5NanoC6_1


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


//定義
#define NUM_LEDS 64
Adafruit_NeoPixel strip(NUM_LEDS, 2, NEO_GRB + NEO_KHZ800);


void setup() {

  //RGB LED
  pinMode(2, OUTPUT);
  digitalWrite(2, HIGH);

  //RGB LED setup
  strip.begin();
  strip.show();

  //USBシリアル用の接続ウェート
  Serial.begin(115200);
  for (int i = 0; i < 9; i++) {
    Serial.print(".");
    delay(500);//接続待ち
  }//for
  Serial.println();

}//setup


int OnOff = (~0);
int line = 7;
int column = 7;

unsigned char Pixel[8][8][3] = {
  { {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} }
};


void loop() {

  //on-off
  if (OnOff != 0) {
    int k = 0;
    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]));
      }//for j
    }//for i
  }//on-off

  strip.show(); //リフレッシュ

  delay(300);//ダミー

}//loop



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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?