サンプルコードを改造するだけでわりとたのしいやつが作れた。
/* Name: button.ino Created: 2018/9/21 14:06:15 Author: sakabin */ #include <M5Stack.h> // The setup() function runs once each time the micro-controller starts void setup() { // init lcd, serial, not init sd card M5.begin(true, false, true); M5.Lcd.clear(BLACK); M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(3); M5.Lcd.setCursor(65, 10); M5.Lcd.println("Button example"); M5.Lcd.setCursor(3, 35); M5.Lcd.println("Press button B 700ms clear"); M5.Lcd.setTextColor(RED); } // Add the main program code into the continuous loop() function void loop() { M5.update(); // if want use Releasefor; suggest use Release in press event if (M5.BtnA.wasReleased()) { M5.Lcd.print(" (--)"); } else if (M5.BtnB.wasReleased()) { M5.Lcd.print(" (^-^)"); } else if (M5.BtnC.wasReleased()) { M5.Lcd.print(" (T^T)"); } else if (M5.BtnB.wasReleasefor(700)) { M5.Lcd.clear(BLACK); M5.Lcd.setCursor(0, 0); } }
-
- M5.Lcd.clear :::もじがきえるみたい