🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stack Fire Buttons is not working.

    M5Stack Fire
    2
    2
    935
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      poyrazturkoglu
      last edited by

      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;
      }

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @poyrazturkoglu

        please have a look at the button example here.

        I think you are missing an M5.update() inside the loop().

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • First post
          Last post