Turning LED on and off?


#1

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.


#2

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


#3

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"


COMPONENT_INIT
{
	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_Activate();
	le_gpioPin7_Deactivate();
    le_gpioPin7_SetPushPullOutput(LE_GPIOPIN7_ACTIVE_LOW, false);
LE_INFO("Pin7 read PP - Low: %d", le_gpioPin7_Read());
	//le_gpioPin7_Activate();
	//le_gpioPin7_EnablePullup();
	//le_gpioPin7_Deactivate();
}

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


#4

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


#5

I have the the mangOH red wp7601-1


#6

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


#7

Hiya,

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


#8

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


#9

and ground is connected to pin 25


#10

Any help please dfrey?


#11

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.


#12

Thank you. It turns out I was not naming it correctly. I was going by the following naming convention
http://legato.io/legato-docs/latest/sampleApps_gpioCf3.html
Thank you for your help