函数原型:
uint8_t read();
功能说明:
传入参数:
返回值:
案例程序:
#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());
}
函数原型:
uint32_t lastChange();
功能说明:
传入参数:
返回值:
案例程序:
#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());
}
函数原型:
uint8_t isPressed();
功能说明:
传入参数:
返回值:
案例程序:
#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);
}
函数原型:
uint8_t wasPressed();
功能说明:
传入参数:
返回值:
案例程序:
#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);
}
函数原型:
uint8_t pressedFor(uint32_t ms);
功能说明:
传入参数:
返回值:
案例程序:
#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);
}
}
函数原型:
uint8_t isPressed();
功能说明:
传入参数:
返回值:
案例程序:
#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);
}
函数原型:
uint8_t pressedFor(uint32_t ms);
功能说明:
传入参数:
返回值:
案例程序:
#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 ");
}
}
函数原型:
uint8_t wasReleased();
功能说明:
传入参数:
返回值:
案例程序:
#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);
}
函数原型:
uint8_t wasReleasefor(uint32_t ms);
功能说明:
传入参数:
返回值:
案例程序:
#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");
}
}