Turning LED on and off?


I tried the two sample applications that come with mangoh red. They one crashes and the other just does not seem to do anything, one is gpioCf3Demo and timerLed, I’m trying to understand how to turn on an LED and the off, but I can’t seem to be able to do that. Can anyone give me a hint as to where to find the right documented libraries so I can make a code myself.


Are you trying to control an LED that’s on the mangOH board or have you connected an LED to a specific GPIO?


I tried to connect an LED to GPIO 22 at first as per gpioCf3Demo but the program crashed, so the I ran TimerLED just to see if that worked but I don’t see any of the LED of my mangOH blink which should make the D750 blink I tried searching for which one might be but nothing blinks. I tried to make one from scratch just so that I could un derstand how to make an LED turn on and off. So I used the following code:

#include "legato.h"
#include "interfaces.h"

	LE_INFO("Initiating LED ON");
	le_gpioPin7_SetPushPullOutput(LE_GPIOPIN7_ACTIVE_HIGH, true);
	LE_INFO("Pin7 read PP - High: %d", le_gpioPin7_Read());
    le_gpioPin7_SetPushPullOutput(LE_GPIOPIN7_ACTIVE_LOW, false);
LE_INFO("Pin7 read PP - Low: %d", le_gpioPin7_Read());

although I think I went somewhere wrong because now that pin is permanently on


Which module are you using? wp85, 76, etc.


I have the the mangOH red wp7601-1


I’m pugging my LED in series with a resistor 300 ohm to pin number 7 according to the user manual



Question: When you say PIN 7, which connector are you referring to?

Looking at the schematic for the mangOH Red, I see that GPIO7 is brought out to the IOT connector GPIO3.

Please note that the IoT interface is at a voltage level of 1V8 … which may be (just) enough to turn on a RED led (voltage drop of 1.7V nominal), but probably NOT enough to turn on a green LED (2V2) and definitely not enough to turn on a white or blue LED (3V3-3V6 depending on brand).

And … I’m not sure if the WP can source or sink enough current (up to 20mA) directly from the I/O pin to light up a led without causing damage to the WP.

ciao, Dave


I’m referring to the raspberry pi connectors, pin number 7 found on schematic on page 24 of user guide.


and ground is connected to pin 25


Any help please dfrey?


Raspberry Pi header pin 7 is labeled as WP_GPIO_3_lvl in the schematic which can be traced to WP_GPIO_3 and finally to GPIO24 on the “outer ring” of the cf3 module. So 24 is the GPIO number that you want to use in your code. Aside from that, your code won’t appear to do much because you turn the GPIO on and then immediately turn it off.

Maybe take a look at the heartbeat app for a demonstration of LED blinking.

GPIOs map for WP77

Thank you. It turns out I was not naming it correctly. I was going by the following naming convention
Thank you for your help


Did you finish the project timerLed? Could you please give me a code, I wanna use the onboard Led but cannot find it out. mangoh_gpioExpPin4 is nothing happen. _gpioExpPin24 is too.


I could not find the code, but I remember that physically I connected to pin 7 (positive side) and pin 25 (ground) then as far as naming convention goes in your code you would call pin 7 pin 24 in code dont know why but thats what it is and well the sample code I have at the beginning did turn on the led and off supper fast so maybe add a timer to it.


@dfrey explained why in his post of 10 May


I tested with heartbeat app, pin14 => button and pin34 => LED display but nothing happen even though I used logread -f to see. Could anyone show me the code? I appreciate, it’s really hard to follow mangOH red.
heartbeat.heartbeatComponent.mangoh_button -> gpioExpanderServiceRed.mangoh_gpioExpPin14
heartbeat.heartbeatComponent.mangoh_led -> gpioService.le_gpioPin34
pin7 => button and pin24 => LED I changed wp86 to wp7607 but it did not work