When I burn uiflow 2.0 for my M5Stack fire device, my buttons work very easily, but when I make a project and want to use the buttons, my buttons do not work. I am using Arduino IDE. My code is below.
#include <M5Stack.h>
// Menü seçeneklerini tanımla
const char* menuOptions[] = {"WIFI EXPLOITS", "BLUETOOTH EXPLOITS", "BAD KB", "BAD USB", "SETTINGS"};
int selectedOption = 0;
void setup() {
M5.begin();
M5.Lcd.setRotation(1); // Ekranı yatay modda kullan
M5.Lcd.fillScreen(TFT_BLACK);
drawMenu();
}
void loop() {
// Butonları kontrol et
if (M5.BtnA.wasPressed()) {
previousOption();
drawMenu();
}
if (M5.BtnC.wasPressed()) {
nextOption();
drawMenu();
}
}
void drawMenu() {
M5.Lcd.fillScreen(TFT_BLACK);
M5.Lcd.setTextColor(TFT_WHITE);
M5.Lcd.setTextSize(2);
// Menü başlığını çiz
M5.Lcd.setCursor(20, 20);
M5.Lcd.print("MENU");
// Menü seçeneklerini çiz
for (int i = 0; i < 5; i++) {
if (i == selectedOption) {
M5.Lcd.fillRect(20, 50 + i * 30, 220, 25, TFT_WHITE);
M5.Lcd.setTextColor(TFT_BLACK);
} else {
M5.Lcd.setTextColor(TFT_WHITE);
}
M5.Lcd.setCursor(30, 55 + i * 30);
M5.Lcd.print(menuOptions[i]);
}
}
void nextOption() {
selectedOption = (selectedOption + 1) % 5;
}
void previousOption() {
selectedOption = (selectedOption + 4) % 5;
}