Blink LED then Stay on constant

Hi,

I’m sure i’m missing a basic boolean operation… I think.

Upon boot, I want an LED to blink 5 times and then stay on while the board is powered.
I have the flip-n-times note active upon boot, but I don’t remember how to keep the LED on constant once the sequence is no longer active…

please help jog my memory. I’m getting old before my time.

thank you

So… my wife, who has never seen nor used XOD before looked at my screen, listened to me complain about not being able to figure this out asked me,
“is there a block that can turn your light on and off for each tick that you ‘flipie’ block turns on and off? like a flip flop?”
so I I added a flip-flop in line and changed my flip-n-times values to get my desired result.
image

I’m leaving this hear so all can see how I solved my problem, instead of just marking this as resolved without sharing how I got here.

Cheers!

1 Like

That works, which means it is a good answer! :slight_smile:

There are probably lots of other answers as well. I was thinking turn LED on if Nc is at final count, but it resets to zero when flipping is done. I guess you could still turn LED on if Nc is zero.

Then I realized, you want LED on if flip-n-times is not active, which gives this solution:
image
I only post this because it is a little less convoluted and points out a technique using ACT pin that often comes in handy. Someone looking at your code would have a little more trouble figuring out what you are trying to accomplish. That doesn’t make your solution “wrong”, but I like KISS (Keep It Simple, Stupid). Depending on what else you are doing and what other code surrounds this, there could be instances where your solution is actually the better solution (like a 2nd LED that flashes twice as fast, then turns off; just connect it to flip-n-times-OUT).

Something that is not immediately obvious…your solution flips more often, which requires more interrupts to handle the timers to do the flips, and flip-flop also uses additional memory. For small projects that don’t do much (or large boards with lots of capacity), this won’t be an issue, but as your projects get larger (or where things might be time-critical), you need to start considering these things.

2 Likes

YES! this is the logic I was looking for. utilizing the T/F of the ACT out from the flip-n-times. Now this will be in my head for a long time.

great answer! thank you!!!

HA! I’m pointing out your solution would be slower…I just noticed your user id :slight_smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.