If else LED blink

I have simple LED and a gps receiver connected to my Mega. I want the LED to blink to while there are less than 4 satellites in view and illuminate while there are 4 or more. I manage to fo the first part and it indeed blinks but when I have more than for it wont illuminate because the if-else statement sends a False signal to the LED. What’s gonna be the best method to implement this case?


You don’t provide your code, so it is difficult to say how it should be fixed. If-else node will pass it’s inputs. Change the input to true (or 1).

OK. Managed to get it working but if GPS initilazes with more than 4 satellites, LED won’t illuminate at all. Only when it gets below 4 and then goes above 4 it will work steady. Any ideas?

A couple issues:

  1. you have two led nodes for the same port, and both are always active. There will be no way to know which value is being used at any time. You should be changing LUM on one led node instead of having two (or add logic for ACT pins so only one is active at any time).
  2. you have if-else nodes that have no value for if-else-F. If if-else-T is true, and if-else-F is supposed to be false, just use the input value; you don’t need the if-else node.
  3. you enable/disable the clock. I assume you disable clock when you want the led on without blink, but there is a 50/50 chance it will be off instead of on. On startup, it will always be off. You could fix this by using ‘not’ node so led is on when flip-flop is off, then sending pulse to flip-flop-RST when clock is disabled (using a pulse-on-false node), but in this case there are easier options (at least intent is more obvious with example below even if it isn’t “easier”; see NOTE below for down-side of the added clarity).

Are you trying to turn LED off for <=2 satellites? This would be one option:

0 would be your number of satellites.
If # satellites <=2, then LED is false (off),
else if # satellites >= 4, then LED is true (on),
else LED gets value of square-wave output (blink)

There are other wave nodes to generate different flash patterns. If output of wave node is numeric, change if-else inputs to 0 & 1 instead of false & true.

NOTE: one advantage of disabling clock (or wave node) when you are not blinking is that you are not wasting CPU and timers when you are not blinking. If this is an issue, you could add code to do this as explained under point 3) above. It could eliminate the if-else with if-else-T set to True (but add several other nodes for controlling count or wave node).

Thanks, buddy. I’ll test in in the next days and I’ll update whats going on.