Sorry couldn't figure out how to post in an existing discussion.

Ah ok, I think I think I know what you mean. I will take any changes you want to make as pure gold, if you say it is neater to preform inside the switch, then that must be the case :slight_smile: I saw the changes you had made but I am still at work at the moment, won’t get a chance to try it till later tonight

now this may be a strange question but I recently purchased some EL wire and tape, I ordered a driver that has adjustable flicker. When the flicker is almost at it’s highest speed it looks to be a constant on, but when it is in motion it causes a tracer style effect.

My question is, is there a way to somehow have and on/off overlay set for all animations and effects, triggered by a separate button where I could pulse everything at a set frequency as to recreate this effect? I suppose in theory the on/off overlay could work, but I would assume the problem may lay with gating upwards of 300 some leds all at once and at a frequency of probably 40hz or perhaps it would just be easier to have only 1 set animation that pulses rather than a whole overlay?

Anyway sort of off topic, I was just thinking about this and if it would look cool.

so after looking at some of the most basic Arduino tutorials I think maybe I could do it by switching the led pin? this would only interrupt the data pin correct? would this be wise at a frequency of 40+hz? or for that matter would it even have time to react and respond to a signal pulse that quick? maybe I should try it on a smaller test matrix as to not burn up the WS2812B IC’s in my matrix that took me forever to solder.

If you want to get a flicker effect you would be better calling clear() and show() periodically as playing with the data pin would interrupt the digital data stream and cause unpredictable results I think. You could just reduce your delay after the show() then add a clear(), show() and delay(). Then you could add another Bouncer2 to control these 3 statements.

BTW I was being stupid when I gave you the memory usage, my matrix is wired for the Octo parallel mode. When I compile it up for regular WS2812B the program goes down to 24,188 and ram to 4604.

Ya I added another 30 frames to the Ekg animation… turns out every 5 frames of code is about 5% of the mega’s memory so 50 frames is a little too much for it to handle. On the plus side of things, the Ekg animation sped up considerably after you removed the show() and clear() funny how a little screw up on my part could be so detrimental to performance. The button function works flawlessly now, thank you by the way. I am hoping that with all of the sprite animations I would like to do the teensy 3.1 can handle it, the specs say that there is 643000kb of memory, I believe anyway.

Thank you again, I will let you know tomorrow if I manage to get the show() and clear() to achieve what I want to try and do. Oh and you are correct about interrupting the data pin, the animation freezes when it looses connection, the WS2812B chip must hold the last call.

Each frame of a 1BIT 32x8should only take 32 bytes of program memory. The Teensy has 256K of program memory and 64K ram.

hmmmm, something is amiss then. I believe the mega 2560 also has 256k of memory and when I compile my 50 frames for the EKG of 8x32 and 9 frames for the eyes it is over the memory limit. I have been writing animations on my tablet during my breaks and have another 100 or so frames for another 2 animations, I am a little dissappointed to hear that the teensy only has 256k, because if the Arduino IDE is correct I will never fit that on.

When I compile up your sketch with 50 frames of EKG for my Teensy I get:
Sketch uses 25,628 bytes (9%) of program storage space. Maximum is 262,144 bytes.
Global variables use 4,604 bytes (7%) of dynamic memory, leaving 60,932 bytes for local variables. Maximum is 65,536 bytes.

It is basically 1440 bytes bigger than the 5 frame version! Your definition still includes the ‘const’ keyword, like this:
const uint8_t EkgData[] =
If it doesn’t then it would allocate ram for the array aswell as rom andbe copying it over when the program is initialised which would take up moew memory.

Ah ok, I will try to recompile it and take out the ‘const’ if it is still there. Good to hear that the teensy is only using up 9% and 7%, I have quite a lot more animations I would like to add.

My brother has made a request of me, I was just wondering if it is possible. On his helmet he would like the ability to have a separate switch to switch to a specific animation. his idea was when he sees a cute girl he would like to switch to a animated heart… if this is not possible it wouldn’t bother me in the least, lol.

Oh wait, you mean to say that it should include the ‘const’. Yes it is there, I did just realize that I switched my animations to 4bit to allow for colour dimming (255, then 185, then 95, then 25 all on red) would this increase the size by 4 or exponentially? I am using 8% of program storage but 89% of dynamic memory, have I screwed something up by including or excluding some important variable? Or does the mega just seriously lack memory?

I think the Mega only has 8K ram, but for the animations this is not a problem as they should be in the program memory.
Try compiling, making a note of the memory usage values, then add an animation frame and compile again. Then compare the memory usage values. This will prove where the animation frame are going.
It would be fairly straight forward to add an override switch that ignores the first loop switch case and performs a custom display. Easier if the switch is latching or a toggle.

Each frame is 128 bytes in 4 bit, and yes you are correct the mega is only showing a maximum of 8192 bytes, that will add up pretty quick with that little amount of ram.

I can do a latching button for sure, hiding a small toggle switch somewhere should be no problem. Or even for that matter using his idea of contacts on the fingers of gloves and having your thumb as the gnd and fingers as individual pins, then it would just be a matter of holding a finger and thumb together for as long as you wanted the animation displayed. Cool well good to know it is possible.

Sorry for throwing so many ideas at you, but you are very knowledgeable and I really appreciate the help you have given me :grinning:.

No problem, and yes you are right, 4bit frames are 128 bytes, but this should be in program memory not ram! To make sure this is happening is why I suggested carefully checking compiler output before and after adding a frame. There should be no extra ram overhead for adding frames to a sprite.

hmmm interesting, can you think of why this might be happening? I complied once again, it adds 128 bytes for both program and ram for each frame.

http://pasted.co/c874379f

here is the updated animation, maybe i did something i should not have? I had to remove the 1 in

struct CRGB EkgColTable[] = { CRGB(255, 0, 0), CRGB(165, 0, 0), CRGB(85, 0, 0), CRGB(25, 0, 0) };

as it complained at me to do so :slight_smile:

Strange! When I compile the code both with and without 1 of the EKG frames I get the expected 128 byte difference in program memory but the ram usage stays the same.
Also of note is that you could use 3BIT which allows up to 7 colours and would only use 96 bytes per frame.

oh, I assumed it was 1 bit per colour, lol. Kind of unfortunate that I have to go back and change all of the 4 bit to 3 bit on 50 frames of 8x32… yeesh. Oh well better get to work :slight_smile: maybe something is wrong with my Arduino IDE? I am using 1.6.4 non-installed. I will try to download a different version and see if that makes a difference.

Use search and replace :wink:
Also don’t forget to change your #define for EKG frames.
Could be the IDE, I am using 1.6.3 and FastLED 3.1.

ah yes, the old search and replace, forgot that existed. I will try with 1.6.3 and 3.1, I did have the frames #DEFINE changed, but I was messing around with other animations swapping in and out probably forgot to change it back.

@Aaron_Liddiment Sorry to bug you again, I am drawing a blank when trying to write this flicker. I don’t know how to define the switch2, here is what I have, maybe you can point me in the right direction?

http://pasted.co/b359db9c

I downloaded arduinodroid IDE on my tablet so I can try and mess around with it at work, so I added another animation. I am not sure if what I did was correct as I cannot test it just yet, but it compiles correctly :slight_smile: