//NeoPixel8x8_0_9_M5StampS3_1
//インクルド
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
//定義
#define MAX_X 8
#define MAX_Y 8
#define NUM_LEDS 64
#define RGBLED_OUT 13
Adafruit_NeoPixel strip(NUM_LEDS, RGBLED_OUT, NEO_GRB + NEO_KHZ800);
unsigned char Pixel[8][8][3]; //キャラクターRAM(カラー)
// 'font8x8_0_9', 8x64px
unsigned char font8x8_0_9[] = {
0x81, 0x7c, 0x7a, 0x76, 0x6e, 0x5e, 0x3e, 0x81, //0
0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, //1
0x81, 0x7e, 0xfe, 0xfe, 0xc1, 0xbf, 0x7f, 0x00, //2
0x81, 0x7e, 0xfe, 0xc0, 0xfe, 0xfe, 0x7e, 0x81, //3
0xe3, 0xdb, 0xbb, 0x7b, 0x00, 0xfb, 0xfb, 0xfb, //4
0x00, 0x7f, 0x7f, 0x01, 0xfe, 0xfe, 0x7e, 0x81, //5
0x81, 0x7e, 0x7f, 0x01, 0x7e, 0x7e, 0x7e, 0x81, //6
0x00, 0x7e, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, //7
0x81, 0x7e, 0x7e, 0x81, 0x7e, 0x7e, 0x7e, 0x81, //8
0x81, 0x7e, 0x7e, 0x7e, 0x80, 0xfe, 0x7e, 0x81, //9
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //: ' '
};
//ネオピクセルに転送後に表示
void NeoPixe_OUT() {
int k = 0;
for (int y = 0; y < MAX_Y; y++) {
for (int x = 0; x < MAX_X; x++) {
strip.setPixelColor(k++, strip.Color(
Pixel[y][x][0], Pixel[y][x][1], Pixel[y][x][2]));
//Serial.print('.');
} //for j
//Serial.println();
} //for i
//Serial.println();
strip.show();
} //NeoPixe_OUT
//8x8文字の表示
void ch_8x8(char ch, int c1, int c2, int c3) {
ch = (ch - '0') * 8;
for (int y = 0; y < MAX_Y; y++) {
int a = font8x8_0_9[ch++];
for (int x = 0; x < MAX_X; x++) {
if (((a << x) & 0x80) != 0) {
Pixel[y][x][0] = 0;
Pixel[y][x][1] = 0;
Pixel[y][x][2] = 0;
} else {
Pixel[y][x][0] = c1;
Pixel[y][x][1] = c2;
Pixel[y][x][2] = c3;
} //if
} //for j
} //for i
NeoPixe_OUT(); //RBG LEDに出力
} //ch_8x8
//初期化
void setup() {
//ネオピクセルの設定
strip.begin();
strip.show();
//シリアルポートの設定
//Serial.begin(9600);
//Serial.println();
//for (int i = 0; i < 9; i++) {
// Serial.print('.');
// delay(500); //接続待ち
//} //for
//Serial.println();
} //main
//メインループ
void loop() {
for (int i = 0; i < 10; i++) {
ch_8x8('0' + i, 5, 5, 5);
delay(3000); //3秒待つ
} //for
} //loop