Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. NUM_LEDS value in LED-Strip Sketch can not be more than "201"?

NUM_LEDS value in LED-Strip Sketch can not be more than "201"?

Scheduled Pinned Locked Moved Troubleshooting
16 Posts 3 Posters 980 Views 3 Watching
  • 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.
  • electrikE electrik

    @zen85 could it be you have an overflow somewhere. You multiply num_leds by another value into an int, perhaps that should be a long

    Z Offline
    Z Offline
    zen85
    wrote on last edited by
    #7

    @electrik

    i also tried to change it into long but there is no change in behaviour...

    1 Reply Last reply
    0
    • Z zen85

      @mfalkvidd

      actually i am using a nano.

      it tells me:

      Sketch uses 18372 bytes (59%) of program storage space. Maximum is 30720 bytes.
      Global variables use 1070 bytes (52%) of dynamic memory, leaving 978 bytes for local variables. Maximum is 2048 bytes.
      

      but there is no warning...

      @electrik

      using wait(...) instead of delay(...) just gives me "wait can not be used as a function arduino" and nothing compiles... did you mean millis(...)?

      electrikE Offline
      electrikE Offline
      electrik
      wrote on last edited by
      #8

      @zen85 that is strange. Are you using the latest drivers?
      See wait here
      https://www.mysensors.org/download/sensor_api_20

      Z 1 Reply Last reply
      0
      • electrikE electrik

        @zen85 that is strange. Are you using the latest drivers?
        See wait here
        https://www.mysensors.org/download/sensor_api_20

        Z Offline
        Z Offline
        zen85
        wrote on last edited by zen85
        #9

        @electrik
        its indeed strange.
        i am using 2.3.1 - so this should be ok.... i replaced delay(wait) with wait(wait) which throws:
        "'wait' cannot be used as a function"

        my nano uses the "atmega328p (Old Bootloader)" as processor... could that be an issue but i dont see how...?

        Z 1 Reply Last reply
        0
        • Z zen85

          @electrik
          its indeed strange.
          i am using 2.3.1 - so this should be ok.... i replaced delay(wait) with wait(wait) which throws:
          "'wait' cannot be used as a function"

          my nano uses the "atmega328p (Old Bootloader)" as processor... could that be an issue but i dont see how...?

          Z Offline
          Z Offline
          zen85
          wrote on last edited by zen85
          #10

          @zen85 said in NUM_LEDS value in LED-Strip Sketch can not be more than "201"?:

          @electrik
          its indeed strange.
          i am using 2.3.1 - so this should be ok.... i replaced delay(wait) with wait(wait) which throws:
          "'wait' cannot be used as a function"

          my nano uses the "atmega328p (Old Bootloader)" as processor... could that be an issue but i dont see how...?

          ok... i see why wait(wait) was a problem... i displaced the variable "wait" with another one and then it compiles... but it has no impact on the issue.

          i also checked out the limit again... it actually works up to 207 leds... more than that and it breaks...

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zen85
            wrote on last edited by
            #11

            oke.... apparently the storage for variables was too low on the nano.

            i replaced it with a mega and now it works.

            1 Reply Last reply
            0
            • electrikE Offline
              electrikE Offline
              electrik
              wrote on last edited by
              #12

              I'm starting to run out of ideas... Is it just the flames that stop working, or is the normal dining still working (when you disable the flames code).
              It seems to me the mysensors task maybe takes to much time from the led strip library, which is quite time critical

              Z 1 Reply Last reply
              0
              • mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by mfalkvidd
                #13

                Seems like teh Arduino IDE is unable to calculate the memory usage for the Adafruit led strip object.
                When the Arduino IDE outputs
                Global variables use 1078 bytes (52%) of dynamic memory, leaving 970 bytes for local variables. Maximum is 2048 bytes
                it has not added the 603 bytes used by the Adafruit led strip object. So the real usage is 1 681 bytes which is 82%.

                Some general information on how Arduino memory works https://learn.adafruit.com/memories-of-an-arduino/optimizing-program-memory but there is not much you can do except switching to a mcu with more ram.

                1 Reply Last reply
                0
                • electrikE electrik

                  I'm starting to run out of ideas... Is it just the flames that stop working, or is the normal dining still working (when you disable the flames code).
                  It seems to me the mysensors task maybe takes to much time from the led strip library, which is quite time critical

                  Z Offline
                  Z Offline
                  zen85
                  wrote on last edited by
                  #14

                  @electrik
                  @mfalkvidd

                  its exactly as you guys say. taking a mega solves my issue and thats fine. i work with arduinos for many years now but its the first time i ran out of storage so i did not have this on the radar. i also learned much about arduinos with that issue. i guess thats a huge thanks for steering me into the right direction.

                  mfalkviddM 1 Reply Last reply
                  1
                  • Z zen85

                    @electrik
                    @mfalkvidd

                    its exactly as you guys say. taking a mega solves my issue and thats fine. i work with arduinos for many years now but its the first time i ran out of storage so i did not have this on the radar. i also learned much about arduinos with that issue. i guess thats a huge thanks for steering me into the right direction.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #15

                    learning is the most fun part of Arduino (at least for me) :-)

                    Great work! If you have the time, you're very welcome to share a photo or video of your project. I have gotten a lot of inspiration from stuff other people have made.

                    Z 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      learning is the most fun part of Arduino (at least for me) :-)

                      Great work! If you have the time, you're very welcome to share a photo or video of your project. I have gotten a lot of inspiration from stuff other people have made.

                      Z Offline
                      Z Offline
                      zen85
                      wrote on last edited by
                      #16

                      @mfalkvidd
                      i will definetly do that within the next days.

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      18

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular