diff --git a/D4han.ino b/D4han.ino index 45d4095..74a6e54 100644 --- a/D4han.ino +++ b/D4han.ino @@ -1,19 +1,19 @@ #include - + #include "Adafruit_SGP30.h" #include #include #include #include - + WiFiMulti WiFiMulti; - - + + Adafruit_SGP30 sgp; TFT_eSprite spu = TFT_eSprite(&M5.Lcd); // Sprite object - + long last_millis = 0; // for 15sec wait timer - + void setup() { M5.begin(115200); M5.Lcd.setRotation(3); @@ -45,23 +45,23 @@ delay(50); } Serial.println(" connected"); - + } - + int sendLineNotify() { HTTPClient http; - + if (http.begin("https://notify-api.line.me/api/notify")) { http.addHeader("Authorization", "Bearer ssJzyHVJE5pELzp0BdX5aieaovE33Md0gcmugu1A6qv"); http.addHeader("Content-Type", "application/x-www-form-urlencoded"); // format of postdata String postdata = "message=二酸化炭素濃度が1000を超えました。換気をしてください。"; int httpCode = http.POST(postdata); - + // httpCode will be negative on error if (httpCode > 0) { // HTTP header has been send and Server response header has been handled Serial.printf("[HTTP] GET... code: %d\n", httpCode); - + // file found at server if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) { String payload = http.getString(); @@ -76,7 +76,7 @@ } return 0; } - + void loop() { static int i = 3; while (i > 0) { @@ -106,7 +106,7 @@ spu.fillSprite( DARKGREY ); //変更点 spu.setCursor(93, 5, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); - spu.printf(" %d \n", sgp.TVOC); + spu.printf(" 4: ");//変更点 spu.setCursor(93, 65, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); @@ -114,7 +114,7 @@ spu.setTextColor( BLUE, CYAN); spu.setCursor(10, 20, 4); spu.setTextSize(1); - spu.println("TVOC : "); + spu.println("LV : "); // 変更点 spu.setCursor(10, 80, 4); spu.setTextSize(1); spu.println("eCO2 : "); @@ -125,7 +125,7 @@ spu.fillSprite( DARKGREEN ); //変更点 spu.setCursor(93, 5, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); - spu.printf(" %d \n", sgp.TVOC); + spu.printf("3" :); // 変更点 spu.setCursor(93, 65, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); @@ -133,7 +133,7 @@ spu.setTextColor( BLUE, CYAN); spu.setCursor(10, 20, 4); spu.setTextSize(1); - spu.println("TVOC : "); + spu.println("LV : "); spu.setCursor(10, 80, 4); spu.setTextSize(1); spu.println("eCO2 : "); @@ -144,7 +144,7 @@ spu.fillSprite( GREEN ); // 変更点 spu.setCursor(93, 5, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); - spu.printf(" %d \n", sgp.TVOC); + spu.printf(" 2);// 変更点 spu.setCursor(93, 65, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); @@ -152,7 +152,7 @@ spu.setTextColor( BLUE, CYAN); spu.setCursor(10, 20, 4); spu.setTextSize(1); - spu.println("TVOC : "); + spu.println("LV : ");// 変更点 spu.setCursor(10, 80, 4); spu.setTextSize(1); spu.println("eCO2 : "); @@ -163,7 +163,7 @@ spu.fillSprite( CYAN ); spu.setCursor(93, 5, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); - spu.printf(" %d \n", sgp.TVOC); + spu.printf(" 1:");// 変更点 spu.setCursor(93, 65, 4); spu.setTextSize(2); spu.setTextColor( WHITE, BLUE ); @@ -171,11 +171,11 @@ spu.setTextColor( BLUE, CYAN); spu.setCursor(10, 20, 4); spu.setTextSize(1); - spu.println("TVOC : "); + spu.println("LV : ");// 変更点 spu.setCursor(10, 80, 4); spu.setTextSize(1); spu.println("eCO2 : "); - - + + spu.pushSprite(0, 0); // 画面に反映させる } @@ -186,7 +186,7 @@ M5.Beep.setBeep(523, 500); M5.Beep.beep(); sendLineNotify(); } - + M5.update(); if (M5.Axp.GetBtnPress() == 2) {