mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
button
This commit is contained in:
@@ -21,8 +21,8 @@ int cur_value1 = 0,cur_value2 = 0;
|
||||
void setup() {
|
||||
M5.begin(); //Init M5Stack. 初始化M5Stack
|
||||
M5.Power.begin(); //Init power 初始化电源模块
|
||||
pinMode(21, INPUT); //set pin mode to input.设置引脚模式为输入模式
|
||||
pinMode(22, INPUT);
|
||||
pinMode(36, INPUT); //set pin mode to input.设置引脚模式为输入模式
|
||||
pinMode(26, INPUT);
|
||||
M5.Lcd.setTextColor(YELLOW); //Set the font color to yellow. 设置字体颜色为黄色
|
||||
M5.Lcd.setTextSize(2); //Setting the Font size. 设置字号大小
|
||||
M5.Lcd.setCursor(80, 0); //Set the cursor position to (80,0). 将光标位置设置为(80,0)
|
||||
@@ -31,8 +31,8 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
cur_value1 = digitalRead(22); // read the value of BUTTON. 读取22号引脚的值
|
||||
cur_value2 = digitalRead(21);
|
||||
cur_value1 = digitalRead(36); // read the value of BUTTON. 读取22号引脚的值
|
||||
cur_value2 = digitalRead(26);
|
||||
M5.Lcd.setCursor(90,25); M5.Lcd.print("Btn.1 Btn.2");
|
||||
M5.Lcd.setCursor(0,45); M5.Lcd.print("Value: ");
|
||||
M5.Lcd.setCursor(0,85); M5.Lcd.print("State: ");
|
||||
|
||||
Reference in New Issue
Block a user