It appears that M5.BtnA.wasPressed() will not work properly if the M5Stack is currently connected via WiFi. I can't find any info on this so I'm posting it here to see if anyone knows anything about this and/or can duplicate what I'm seeing. (BtnB and BtnC work just fine with WiFi connected...)
Is there some sort of resource conflict? It appears that BtnA can not be reliably used if the device is connected via WiFi. The pin appears to become unstable (no pullup/pulldown?) or maybe is being used for some other WiFi related function.
Leave code below as is to see unstable BtnA. Comment out just the thyree WiFi connect lines to see BtnA working as expected:
----- Code Below ---------------
#include <M5Stack.h>
#include <WiFi.h>
void setup(){
M5.begin();
// Comment out the next three lines for Button A to work properly
WiFi.begin("SSID", "PWD");
while (WiFi.status() != WL_CONNECTED) {
}
M5.Lcd.println("Ready!");
}
void loop() {
if(M5.BtnA.wasPressed()) M5.Lcd.println("Button A");
M5.update();
}