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

    [Solved]How to use interruption processing in m5stack

    Cores
    3
    8
    18.0k
    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.
    • T
      tkb koki
      last edited by m5-docs

      I want to make a simple game.
      When you pressed button of m5stack, how did you move other function?
      There is not other function in roop().I use Arduino1.8.9.

      m5-docsM 1 Reply Last reply Reply Quote 0
      • m5-docsM
        m5-docs @tkb koki
        last edited by m5-docs

        @tkb-koki Do you means how to use BUTTON on M5Stack Core?

        If I am right, you can refer to the code blow.

        https://github.com/m5stack/M5Stack/tree/master/examples/Basics

        /*
            Name:       button.ino
            Created:    2018/9/21 14:06:15
            Author:     sakabin
        */
        
        #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.Lcd.clear(BLACK);
          M5.Lcd.setTextColor(YELLOW);
          M5.Lcd.setTextSize(2);
          M5.Lcd.setCursor(65, 10);
          M5.Lcd.println("Button example");
          M5.Lcd.setCursor(3, 35);
          M5.Lcd.println("Press button B for 700ms");
          M5.Lcd.println("to clear screen.");
          M5.Lcd.setTextColor(RED);
        }
        
        // Add the main program code into the continuous loop() function
        void loop() {
          M5.update();
         
          // if you want to use Releasefor("was released for"), use .wasReleasefor(int time) below
          if (M5.BtnA.wasReleased()) {
            M5.Lcd.print('A');
          } else if (M5.BtnB.wasReleased()) {
            M5.Lcd.print('B');
          } else if (M5.BtnC.wasReleased()) {
            M5.Lcd.print('C');
          } else if (M5.BtnB.wasReleasefor(700)) {
            M5.Lcd.clear(BLACK);
            M5.Lcd.setCursor(0, 0);
          }
        }
        © 2019 GitHub, In
        

        M5Stack documentation URL

        https://docs.m5stack.com

        1 Reply Last reply Reply Quote 0
        • T
          tkb koki
          last edited by

          @m5-docs No, i was able to use BUTTON.
          I want to use other function while executing "delay();".

          ajb2k3A m5-docsM 2 Replies Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @tkb koki
            last edited by

            @tkb-koki What programming system are you using?
            In UIFlow you have a series of loops including loops dedicated to just the three buttons on the front.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            T 1 Reply Last reply Reply Quote 0
            • m5-docsM
              m5-docs @tkb koki
              last edited by

              @tkb-koki multi-Progress?

              M5Stack documentation URL

              https://docs.m5stack.com

              T 1 Reply Last reply Reply Quote 0
              • T
                tkb koki @ajb2k3
                last edited by

                @ajb2k3 I am using Arduino IDE.

                1 Reply Last reply Reply Quote 0
                • T
                  tkb koki @m5-docs
                  last edited by

                  @m5-docs not multi. I want to use interruption processing.

                  m5-docsM 1 Reply Last reply Reply Quote 0
                  • m5-docsM
                    m5-docs @tkb koki
                    last edited by

                    Hello @tkb-koki,

                    How about this example code?

                    https://github.com/futureshocked/ESP32-For-Busy-People-1/blob/9ede724a862539ae18aad1500426ceb4415d5052/04-070_Interrupt_with_button_and_led/04-070_Interrupt_with_button_and_led.ino

                    M5Stack documentation URL

                    https://docs.m5stack.com

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