Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Variable name stopping Switch from working - weird!!!

  1. #1
    Senior Member
    Join Date
    Jun 2015
    Posts
    231

    Variable name stopping Switch from working - weird!!!

    I've just spent the last few days troubleshooting a really annoying problem with a Teensy 3.6 project of mine.

    I have 24 (3 x banks of 8) momentary switches connected to Digital inputs.
    One switch toggles the state/mode of the top row - so that they can perform different things in differnt modes.

    The strange thing is, when flipped to the 2nd mode, the 5th Switch stops working after the first time it is pressed.
    All other switches work OK.
    Even flipping back to mode 1 - switch 5 still does not work.
    I had to reset the Teensy to get it to work again.

    After confirming it wasn't a hardware/switch issue - I finally tracked down the lines of code that were causing the issue ... more specifically the 2 lines with "Param4_Value"

    for (int i=0; i<Value_Len; ++i)
    {
    Param4_Value[i] = {' '};
    }

    for (int i=0; i<Value_Len; ++i)
    {
    Param4_Value[i] = MIDI.getSysExArray()[i+18];
    }
    This variable declared earlier as
    char Param4_Value[8];
    .

    It is only called up in 1 other place & that is used to display the value on a screen.
    mydisp[5].print(Param4_Value);
    but I confirmed that that line was not causing the issue.

    After reaching the verge of going crazy - for some reason I decided to rename the variable to "Param44_Value" & hey presto - everything works!

    Although glad it's resolved, I'm desperate to understand why this was happening.
    ANy ideas anyone pls?

  2. #2
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    I had similar experience and it had to docompiled. Errant caching of files during compiles. This went away with an upgrade to new arduino and teensyduino.

  3. #3
    Senior Member
    Join Date
    Jun 2015
    Posts
    231
    Quote Originally Posted by RichardFerraro View Post
    I had similar experience and it had to docompiled. Errant caching of files during compiles. This went away with an upgrade to new arduino and teensyduino.
    hmmm- interesting - thanks.

    TBH - I haven't updated either (IDE or Teensyduino) is a very long time.

    Maybe now is the time.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •