🤖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.

    Scheduled Pinned Locked Moved M5Stack Fire
    2 Posts 2 Posters 2.3k Views
    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 Offline
      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 Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post