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?

M5SatmpS3、8x8 Puzzle Unit (Unit Puzzle ?)で「あ、埼玉」と表示。

Last updated at Posted at 2025-05-06

参考

いろいろ、注意

  • M5Stack by M5Stack official 2.1.4

結果

image_original(31).jpg

プログラム



//NeoPixel8x8_kanji_M5StampS3_1


//インクルド
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include <misakiUTF16.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(カラー)


//ネオピクセルに転送後に表示
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_f(unsigned char *font, int c1, int c2, int c3) {

  int i = 0;
  for (int y = 0; y < MAX_Y; y++) {
    int a = font[i++];
    for (int x = 0; x < MAX_X; x++) {

      if (((a << x) & 0x80) != 0) {
        Pixel[y][x][0] = c1;
        Pixel[y][x][1] = c2;
        Pixel[y][x][2] = c3;
      } else {
        Pixel[y][x][0] = 0;
        Pixel[y][x][1] = 0;
        Pixel[y][x][2] = 0;
      }  //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() {

  unsigned char font[8];  // フォント格納バッファ

  char *str = "あ、埼玉";  // 文字列
  char *ptr = str;

  while (*ptr) {                   // 文字列分ループ
  
    ptr = getFontData(font, ptr);  // 1文字分のフォント取得
    if (!ptr)
      break;  // エラーの場合は終了

    ch_8x8_f(font, 5, 5, 5);
    delay(3000);  //3秒待つ

  }  //while

}  //loop



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?