Syntax:
uint8_t read();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.Lcd.setCursor(0, 0);
M5.Lcd.printf("Button A Status: %d ",M5.BtnA.read());
}
Syntax:
uint32_t lastChange();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
M5.Lcd.setCursor(0, 0);
M5.Lcd.printf("The last change at %d ms /n",M5.BtnA.lastChange());
}
Syntax:
uint8_t isPressed();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
M5.Lcd.setCursor(0, 0);
if (M5.BtnA.isPressed()) {
M5.Lcd.println("Button is Pressed.");
}else{
M5.Lcd.println("Button is Released.");
}
delay(20);
}
Syntax:
uint8_t wasPressed();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
if (M5.BtnA.wasPressed()) {
M5.Lcd.println("Button is pressed.");
}
delay(20);
}
Syntax:
uint8_t pressedFor(uint32_t ms);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
if (M5.BtnA.pressedFor(2000)) {
M5.Lcd.println("Button A was pressed for more than 2 seconds.");
delay(1000);
}
}
Syntax:
uint8_t isPressed();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
}
void loop() {
M5.update();
if (M5.BtnA.isReleased()) {
M5.Lcd.println("Button is released.");
}else{
M5.Lcd.println("Button is Pressed .");
}
delay(20);
}
Syntax:
uint8_t pressedFor(uint32_t ms);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
}
void loop() {
M5.update();
M5.Lcd.setCursor(0, 0);
if (M5.BtnA.releasedFor(2000)) {
M5.Lcd.println("Button A was released for more than 2 seconds.");
delay(1000);
}else{
M5.Lcd.println("Button A is pressed ");
}
}
Syntax:
uint8_t wasReleased();
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
if(M5.BtnA.wasReleased()) {
M5.Lcd.println("Button is Released.");
}
delay(20);
}
Syntax:
uint8_t wasReleasefor(uint32_t ms);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.println("Please pressed Button A.");
}
void loop() {
M5.update();
if (M5.BtnA.wasReleasefor(3000)) {
M5.Lcd.println("OK");
}
}