Newer
Older
m5stickcplus / src / wifi01.ino
@Motoki Motoki on 15 Mar 796 bytes 2025
#include <M5StickCPlus.h>
#include <WiFi.h>

const char* ssid = "ics-ap";
const char* password = "jikkenics";

void setup() {
  M5.begin();
  M5.Lcd.setRotation(3);
  M5.Lcd.fillScreen(ORANGE);
  M5.Lcd.setCursor(10, 50, 4);

  WiFi.begin(ssid, password); // 接続開始
  while (WiFi.status() != WL_CONNECTED) { // 接続中...
    M5.Beep.tone(2000);  delay(200);
    M5.Beep.mute();  delay(300);
    M5.Lcd.print(".");
  }
  // 接続完了!!
  M5.Beep.tone(4000); 
  M5.Lcd.fillScreen(GREEN);
  M5.Lcd.setCursor(0, 40, 4);
  M5.Lcd.setTextColor(BLACK, GREEN);
  M5.Lcd.print("  Wifi Connected!\n  ");
  String gotip = WiFi.localIP().toString(); // m5デバイスのIPアドレス
  M5.Lcd.println(gotip);
  delay(1500);
  M5.Beep.mute();
}

void loop() {
}