-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
I reported this in the M5Stack community forum and also the M5Stack Github. Someone else also found this problem and reported that if the IDF was rolled back it went away. (http://forum.m5stack.com/topic/174/m5-btna-waspressed-conflicts-with-wifi) So it looks like this is an issue with the current IDF:
It appears that M5.BtnA.wasPressed() will not work properly if the M5Stack is currently connected via WiFi. It appears that BtnA can not be reliably used if the device is connected via WiFi. The pin appears to become unstable or maybe is being used for some other WiFi related function.
Leave code below as is to see unstable BtnA. Comment out just the three 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();
}