Hey Guys, Need some debugging help here.

Hey Guys, Need some debugging help here.

I was trying to get the BoucingBall to work in a new sketch:
http://pastebin.com/CGFFZsmN

But for some reason I cant get it to work.

Here is the code from another working sketch of mine, where I was using a single array instead: it works fine for the bouncing ball.
http://pastebin.com/m56ftyCf

My variables dont seem to be updating in my Bluetooth revamp code.

It kind of messy now with some inline debugging serial lines, but I have to be missing something simple thats different between the two.

all my other effects are working fine.

FastLED 3.1
Teensy 3.1
Arduino 1.6.4

going stircrazy tracking what should be a simple fix.

So I narrowed it down to some stupid timing issue…

the millis() is causing issues for some reason.

my serial output show the timing variable isnt changing… but the code is identical???

http://pastebin.com/5fWgTufy

It looks to me like millis() is running based on the output you shared. I feel like I’m missing something.

Which value are you seeing not change?

sorry i think millis() is working fine, but for some reason my variables aren’t updating the same between the two sketches.

In my broken code, the tCycle is always zero.
the millis() call and the tLast variable are always the same:
|tCycleBefore| 0.00
|tLast| 1860
|millis| 1860
operation >>> tCycle = millis() - tLast
|tCycleAfter| 0.00
|tLastAfter| 1860

what it should look like
|tC| 0.00
|tL| 5004
|millis| 5335
operation >>> tCycle = millis() - tLast
|tCa| 331.00
|tLa| 5004

So somethings funky with my tLast being set the same time millis() is called… and im baffled. I have some other troubleshooting ideas to try tonight.

Needed to post to help work/think out the problem in my head… and vent a bit. Too many hours wasting on a stupid little bug.

Could you be running out of memory? From doing a quick visual static analysis, it looks like you’ve got about 45kB of RAM used, just in led and heat arrays.

What happens if you set MAXNUM_LEDSPERROW to 20?

my compile says I have plenty of room on my teensy. I’ll give it a try tonight, thanks!

ok so it was a completely stupid bug afterall…

my changemode function… it kept resetting all the timing variables on every loop…

i have a switch for picking the mode and setting the effect…

case 11:
Branch1.BouncingBall(); Branch5.BouncingBall(8);
Branch2.BouncingBall(2); Branch6.BouncingBall(8);
Branch3.BouncingBall(4); Branch7.BouncingBall(8);
Branch4.BouncingBall(7); Branch8.BouncingBall(8);

then added this line:
ledMode = 888; //reset to neutral mode after effect is set
break;

silly silly stupid.

but i was able to do a real good review of my code and cleanup some other junk from this exercise, so all is not lost.

Hey- glad it’s working now.