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

Try this instead :wink:
http://pasted.co/bd2c710b
To implement another digital input you have to define another bounce variable as I have done in the above paste. You will also notice I have used a LOW check this time so that it does the clear()/show() whenever the switch is held down.
You had just about added the new sprite correctly but had messed up the plasma text case in the switch, I have corrected it.
You will also notice I have made the 1,2 & 3 options in the switch case common as they were performing the same commands.
And finally, I have changed your EKG data to use 3BIT instead of 4BIT :slight_smile:

Ah I see instead of debouncer.attach(SWITCH_PIN); for a definition you defined it Flicker instead of debouncer, and I definitely see where I messed up with the plasma :slight_smile: I forgot to put it within the case. Good to see that I at least was on some semblance of a right track :slight_smile:

Thanks again, I am trying to put some of this information I am slowly obtaining to use. I really appreciate having had someone as experienced as yourself helping me out.

I will now attempt the switch case for a separate animation, may take me a few days to sort it out and get some time to try it out.

I’ll get back to you about how the flicker turns out, and if I can get the frequency I am looking for :slight_smile:

The flicker works :slight_smile: is there any way to get a delay() faster than 1? I tried .5 then .25 the .05 but they all sort of look the same, don’t get me wrong it serves it’s purpose, but at this refresh it is a little abrasive. I will be running it at about 20 brightness so maybe that will help with the abrasiveness :slight_smile:

Even if you removed the delay(), I think the delay will be too much perhaps. This is because the show() call takes several milliseconds to stream data to 256 led’s.

I think you are right on that one, dimming the brightness seemed to help with the abrasiveness and I tried messing around with parameters a little I.E. UPDATES_ PER_SECOND and then changing delay() to FastLED.delay(1 / UPDATES_PER_SECOND) but I cannot achieve anything faster than what is there.

I also tried to add the switch case for the “on the fly animation”, I used the same switch as the show() clear(), but I am having problems with it only appearing within the sprites portion, and if it is held it will not animate. I also had to add a Sprites.RemoveSprite(&SprHeart); to every sprite switch case to stop it from appearing within each sprite animation.

anyway here is what I came up with, I am sure there is something more elegant than what I have attempted But let me know if I am on the right track :slight_smile:

http://pasted.co/59e687f9

ok, try http://pasted.co/ed5b897b
You will need to download a new version of my sprite code from github as I have added a RemoveAllSprites() function to make life easier.
You will see that I detect the press of the heart switch and set an override variable and then also detect it being released and clear the override. By using fell() & rose() you can detect the event whereas using read() you just detect the current state which is why the heart never animated :wink:

Awesome! I have not tried this yet, but it will undoubtedly work :slight_smile: I took a quick look at it, but will take a closer look during my breaks :wink: I can see roughly what you did with the “remove all” and the switch cases. I will be promptly downloading your new library from github.

Thanks again, I should be able to plug away at this for a little while at least making new animations and such. I may be asking for your assistance once again in a little while, I need to finish soldering my brother’s vertical 8x39 matrix for his helmet, the pattern is 39 columns in a zigzag pattern, I foresee a few problems with this layout but I have no other choice but to wire it this way due to visibility. I am thinking the animations will show up a little different and I think I have an idea of how I need to layout the sprite frames. I am also thinking of implementing Mark Kriegsman’s FireworksXY program into this rotation as the vertical matrix should provide a good canvas for this :slight_smile:

For any of my code you can easily change the matrix type as well as the origin. It is also possible to use the (X,Y) access to the LED’s which would mean with one simple change both helmets would look the same.

@Aaron_Liddiment So my mind will not stop talking to itself at night :slight_smile: I was thinking it would be nice to have one of the switch cases as a randomize, maybe with a timed interval? is something like this possible? I took a quick look through then Bounce2 keywords but didn’t see anything. Maybe something like

break;
  case 6:

switch (Random())
break;

??

thinking about it a little whilst I work, probably need an if?

if (myMode = 6)
myMode = random();
switch (myMode)

but would this just cause an infinite loop impossible to get out of?

and of course I would have to define
random(min, max) to be within 0-5 or however many more cases I add excluding the randomize switch (being the last) Or is this another time where a toggle would be much easier? I wouldn’t really mind either way.

You would have to add a timer or counter as well to set how long the random mode would go for. You could then just detect a LOW and if the counter/timer was about to expire, set a new myMode!

my tablet does not have all the libraries that my computer does so it is not compiling correctly for other reasons, but have a look at this and let me know if I am close to my goal :slight_smile:

http://pasted.co/69061a18

sorry still had compile errors, changed it up and it compiles fine now. probably doesn’t do what I would like, but hey even shooting blind you get lucky right?

http://pasted.co/978839e5

You have an empty switch case at line 1036!
Not quite sure what you are trying to do. I thought you wanted a physical switch that when held down would randomly select the mode and change after a time period.
If you want to just randomly select the next pattern when your current switch is pressed you could replace the myMode++ with a random number being assigned to myMode.

Lol, ya I sort of figured that out last night. I was trying to see if I could make switch case 6 a “random mode”. Now that I think about it a little more, a toggle switch for the random mode would probably be better off. I did manage to have the switch change to a random program every time it is pressed, more or less an unintended result but it meant I was at least half way there :slight_smile: I will try today to make the toggle work, I am fairly confident that I can do so.

Ok so I tried muddling around in stuff I apparently still do not fully comprehend. I can get it switching at random, but get some weird side effects like sprites overlapping, but the random is on every regular button press (not quite what I wanted) I created another toggle switch case and attempted to add a counter and change myMode to random, also has some weird effects, only rotates between the first animation and the scrolling text and a blank page? no sprites or plasma animation.

I would like to know you opinion on how badly I pooched this up :slight_smile:

http://pasted.co/bc12bc4d

http://pasted.co/fa9cda63
Ok, so I completely rewrote the loop() as it was getting messy.
You will see that it does all the switch checking at the top, then does mode initialising if required and finally does the led updates and show.
This means that we only have one initialise block and one update block which should make the code easier to work on in the future.
I don’t have time to hook up all those switches so I know it compiles correctly but not if it works correctly :wink:

Worked awesome :slight_smile: I am definitely learning a lot as I go, you have definitely been a great help. Although I did not really manage to figure this last one out just yet, I’ll take a bit if a longer look tomorrow and see if I can get a better handle on it.

Sort of on a side note, how hard wold it be to set different time spent on certain cases? I am considering splitting up the colour pallet animation into individual as to give it a more full random feel and I potentially wanted some animations to play longer than others. If this is easily done that would be great, but if it is going to be a huge pain in my butt just let me know, lol.

You could declare an array of uint16_t that matches the size of the maximum myMode and then just use myMode as the index on this array when you assign it to count:

uint16_t myCounts[6];

RandomCount = myCounts[myMode];

Another thing to do would be to use an enumerated type for the myMode value:

enum ModeType_t {
MODE_PALETTE,
MODE_EYES,
MODE_EKG,
MODE_HEART,
MODE_TEXT,
MODE_PLASMA
MODE_MAXIMUM };
static ModeType_t myMode;

Then you can use the matching MODE_? in the switch cases instead of absolute numbers. This makes it simpler to add new modes in any position as they will automatically renumber correctly. Plus the last one ‘MODE_MAXIMUM’ will be equal to the number of modes that you have:

myMode = random8(0, MODE_MAXIMUM);
and
if (myMode >= MODE_MAXIMUM)

Also you would then use MODE_HEART instead of the 3 that you assign myMode in the heart override.

… alright it will take a bit for me to absorb that one, lol. I’ll see what I can come up with. I am out of camp tomorrow so I probably won’t get a chance to work on this for a couple of days at least. I will let you know what I come up with though. It does look like you laid it out pretty much as it should go in though :slight_smile: