Temporary overriding of the R/G LED

I have an application where it would be useful, once the Red/Green LED is in power off mode to be able to turn the LED on for periods of a second or so with a colour of my choice, as an indicator. We are talking several times a day, not several times a minute.

I am just wondering if there is code available to permit this. Thanks

The leds are reserved for the imps status and cant be controlled.

As MikeyDK says, this can’t be done as the LED is reserved. If you were connected and wanted to flash green once every hour, you could just enable blinkup for a second (green should show) then disable it :slight_smile:

As someone who is transitioning from the Spark Core, which permits this, I would like to suggest that developers get the ability to use the LED.

There is a very good reason not to do this. It would be similar to hooking your car tailights up to a button on a child seat and letting them mash away on them while you drive. They are reserved for a reason.

I have been using spark core too, and ended up having problems debugging it, because a sketch was taking control of it.

I have found a solution - it works, but wastes a pin. I have connected one of the other outputs to the green pin of the LED via a 100 ohm resistor. When I am not using it, I leave my pin as an Input. From my analysis, it appears that the R & G LEDs are also put into high impedance mode when they are not used to save energy. Since I am not using it in the first period during Blink-Up, and the LED is only coming on for 250 mSec, this should be fine.

Jwehr - I disagree that this is like hooking headlights to a button on the childs seat. This issue only comes up when people are expecting certain behavior from my device. But since this is my device, I can condition them to expect whatever behavior I want.

It is more like having a light on the dashboard that normally only lights up when the car is first turned on, but also comes on when you put the car into reverse. If the driver expects this behavior, things should be fine

MikeyDK - I had similar issues. Putting a 100 mSec sleep in the idle loop of the Spark helped, but not always, hence my moving to the Imp.

@vk2tds My problem was that it would not flash my code, maybe… And I could not be sure if it was some of my code working, or if it was the system trying to show me something.

And problem after problem putting new code on the spark core, also made me ditch it and continue with just Imps :smiley:

Interesting. Throughout the thread I had assumed you were talking about controlling the embedded LED of the -001, not the external LED typically connected to an -002.

Thanks for noting that LED_RED and LED_GREEN signals of the -002 go high-Z post BlinkUp.

They don’t actually go high-Z. They are push-pull, set to the inactive state (which can be high or low, depending on whether you’re using CC or CA LEDs).

When you drive against this, you have a 100R+whatever resistor you have in the LED path for the imp control between your IO pin and GND/3.3v; this could be burning rather a lot of power when the LED is on.

Got it. Thanks for the correction. Given that, it doesn’t seem as if there’d be quite enough drive from the second pin to overcome the inactive state pull of the LED_GREEN or LED_RED pins, but sounds like @vk2 has got something to work. (And only doing it for a fraction of a second a few times a day, doesn’t seem like power consumption would be a big deal).

(Was just interesting to follow along. No intent on my part to actually re-purpose the LED … me, I’d just stick another one in :slight_smile: ).

Well, quite. If you’re prepared to expend a pin on this problem – why not just put your own LED on it?

Peter

Thanks for the clarification. In that case, it appears that the 100R on the circuit will be creating a resistor divider with my 100R, when I have my pin on. This creates a resistor divider, taking the 3.3V, and making it nominally 1.65V, which is just enough, ignoring the voltage drop across the resistor. Not ideal since the output pins of the IO lines are only rated to 8 mA, and this will be slightly above that.

My next version will use a diode and a 47R instead of the 100R on driving the LED from the LED output and the same in parallel from the IO pin. The Diode will drop 0.7V nominally rather than the 1.3v that the resistor drops normally, so the value of the resistor needs to drop. This will bypass the effects of push/pull

@peter, not all engineering problems are electrical. Some are based on user interface/mechanical/aesthetics. Whilst I could put another LED on the device, the product looks best with the number of 5mm devices I already have. Another one would destroy the symmetry of the product, and just be too much.

– Darryl

You can get triple LEDs, R/G/B, in a single 5mm housing.

Peter