M5STACK 上的简单菜单

问题描述

您好,我想在 M5STACK 上创建一个简单的菜单,我可以在其中选择两个元素,然后能够在其 2 个元素中的每个元素中进行编程。 能够使用 M5stack 的第一个按钮向左走,第二个选择,第三个向右走 这是已经完成的代码

/*
    Name:       Théo.Dedouet
    Created:    2018/9/21 14:06:15
*/

#include <M5Stack.h>
// The setup() function runs once each time the micro-controller starts
void setup() {
  // init lcd,serial,but don't init sd card
  M5.begin(true,false,true);
  
  M5.Power.begin();

  M5.Lcd.clear(BLACK);
  M5.Lcd.setTextColor(YELLOW);
  M5.Lcd.setTextSize(2);
  M5.Lcd.setCursor(65,10);
  M5.Lcd.println("Prises Commandees");
  M5.Lcd.setCursor(3,35);
  M5.Lcd.println("Presser le bouton B pour   700ms");
  M5.Lcd.println("Pour tout nettoyer.");
  M5.Lcd.setTextColor(WHITE);
}


void loop() {

  M5.update();
 
  if (M5.BtnA.wasReleased() || M5.BtnA.pressedFor(1000,200)) {
    M5.Lcd.print('A');
  } else if (M5.BtnB.wasReleased() || M5.BtnB.pressedFor(1000,200)) {
    M5.Lcd.print('B');
  } else if (M5.BtnC.wasReleased() || M5.BtnC.pressedFor(1000,200)) {
    M5.Lcd.print('C');
  } else if (M5.BtnB.wasReleasefor(700)) {
    M5.Lcd.clear(BLACK);
    M5.Lcd.setCursor(0,0);
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)