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

M5Stack Core S3 で Wi-Fi QRコードの表示

Last updated at Posted at 2025-12-18

Wi-Fi接続用のQRコード1を表示します。
動的にQR画像を入れ替える事で何かできそうな気がします。
Eペーパーデバイスの方が相性良さそうですね。(でも、持っていない)

#include <M5CoreS3.h>

const char* ssid = "MyHomeWiFi";
const char* password = "MySecurePassword123";

bool isVisible = true;

void displayQRCode() {
  M5.Display.fillScreen(BLACK);
  M5.Display.setTextColor(WHITE);
  
  M5.Display.setTextSize(2);
  M5.Display.setCursor(70, 5);
  M5.Display.println("Wi-Fi QR Code");
  
  M5.Display.setTextSize(1);
  M5.Display.setCursor(10, 30);
  M5.Display.print("SSID: ");
  M5.Display.println(ssid);
  M5.Display.setCursor(10, 45);
  M5.Display.print("Pass: ");
  M5.Display.println(password);
  
  String qrData = "WIFI:T:WPA;S:";
  qrData += ssid;
  qrData += ";P:";
  qrData += password;
  qrData += ";;";
  
  M5.Display.qrcode(qrData.c_str(), 70, 60, 180, 6);
}

void setup() {
  auto cfg = M5.config();
  M5.begin(cfg);
  
  M5.Display.setRotation(1);
  
  displayQRCode();
}

void loop() {
  M5.update();
  
  auto t = M5.Touch.getDetail();
  if (t.wasPressed()) {
    isVisible = !isVisible;
    
    if (isVisible) {
      displayQRCode();
    } else {
      M5.Display.fillScreen(BLACK);
      M5.Display.setTextColor(WHITE);
      M5.Display.setTextSize(2);
      M5.Display.setCursor(60, 110);
      M5.Display.println("Tap to show");
    }
    
    delay(200);
  }
  
  delay(10);
}

作ったものより目立つスタックチャンの図

M5Stack Core S3 で Wi-Fi QRコードの表示.png

  1. QRコードは株式会社デンソーウェーブの登録商標です

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