Upgrade to Pro — share decks privately, control downloads, hide ads and more …

M5Stack Core2とAlexaでインターフォンに自動で対応してくれるIoTデバイスを作...

Avatar for ufoo68 ufoo68
December 21, 2021

M5Stack Core2とAlexaでインターフォンに自動で対応してくれるIoTデバイスを作りたかった話

Avatar for ufoo68

ufoo68

December 21, 2021
Tweet

More Decks by ufoo68

Other Decks in Technology

Transcript

  1. ネット記事のコードをコピペでOK void otaSetup() { ArduinoOTA.setHostname("m5stack-core2"); ArduinoOTA .onStart([]() { String type;

    if (ArduinoOTA.getCommand() == U_FLASH) type = "sketch"; else // U_SPIFFS type = "filesystem"; Serial.println("Start updating " + type); }) .onEnd([]() { Serial.println("\nEnd"); }) .onProgress([](unsigned int progress, unsigned int total) { Serial.printf("Progress: %u%%\r", (progress / (total / 100))); }) .onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); else if (error == OTA_END_ERROR) Serial.println("End Failed"); }); ArduinoOTA.begin(); } PlatformIO向けの記事でなくても 基本は動くと思います