we are stuck again. On the newest Version we are not able to make the BUTTON work.
We tried following code from the documentation on a X4 v1.1 and X4 v1.0 :
void setup() {
// Run code and jump to loop()
Serial.begin(115200);
// Wait until button is pressed & print message
while (!Button.waitClick(1000)) {
Serial.println(“Waiting for a button press…”);
}
}
void loop() {
Serial.println(“Code is running…”);
delay(500);
}
On both boards, the code runs but even if we press the button, it still outputs “Waiting for a button press…” on the Serial monitor.
Until new version is released (already working on it), use this workaround:
IOButton button(BUTTON_BUILTIN); // Create "button" object
void setup() {
// Run code and jump to loop()
Serial.begin(115200);
// Wait until button is pressed & print message
while (!button.waitClick(1000)) { // use "button" instead of "Button"
Serial.println("Waiting for a button press…");
}
}
void loop() {
Serial.println("Code is running…");
delay(500);
}
All the same functionality is available. It simply creates “button” object, attached to gpio pin 18. Same thing as predefined “Button” does.