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

    Compile but does not work with a for next loop

    Scheduled Pinned Locked Moved Arduino
    3 Posts 2 Posters 3.6k 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.
    • F Offline
      F1CJN_Alain
      last edited by F1CJN_Alain

      My short exemple prints a number on the screen
      But if I include a for next loop , it compiles but does not show the number on the M5 core screen.
      If I uncomment the" for next" line, it does not print on the screen . Why ?

      #include <M5Stack.h>
      #include "M5StackUpdater.h"
      float voltage = 2224.33;

      void setup() {
      M5.begin();
      }
      void loop() {
      //for (int i = 1; i = 10; i++) {}
      M5.Lcd.setTextColor(WHITE, BLUE);
      M5.Lcd.drawString("Voltage = "+String(voltage)+" mV ",30,40,4);
      delay(50);
      }

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

        Hello @F1CJN_Alain

        try with for (int i = 1; i <= 10; i++) instead. Eg. i <= 10 instead of i = 10.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • F Offline
          F1CJN_Alain
          last edited by

          Thanks a lot, Félix. I was concentrated on a big file and did not notice this .
          Regards
          Alain Hamradio F1CJN

          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