11 years, 1 month ago.

How do it create to flash 3 color LED?

Your Test Program is good. It is very easy to start Programming of LPC800. I can flash Blue color. But it defined at same time of LED1, LED2, LED3, it shows a little not normal operation. For Example,

include the mbed library with this snippet

#include "mbed.h"
DigitalOut myled3(LED3); //Red
DigitalOut myled1(LED1); //Blue

int main()
{
 while(1)
 {
    myled3=1;myled1=0;
    wait(0.2);
    myled3=0;myled1=0;
    wait(0.2);
    myled3=0;myled1=1;
    wait(0.2);
    myled3=0;myled1=0;
  }
}

Above program is expected, 1. Red lighting 2. LED off 3. Blue lighting 4. LED off

But LED cannot OFF. Why?

And I have one more question about these pin output. I think that these pin can use as GPIO. But I don't know how is define these pin name in mbed compiler. Is not support yet?

Question relating to:

2 Answers

11 years, 1 month ago.

The LEDs on the lpc max board are wired differently from those on the lpc1768 board: the LED for the lpc812 will turn ON when you set the pin LOW and turns OFF when the pin is HIGH. LED1 is blue and pin is P0_16, LED2 is green and pin is P0_17, LED3 is red and pin is P0_7. LED4 is same as LED2, red. As soon as you declare a pin it will go low and so default all Leds are ON. All led pins are also available on the lpc max external connectors.

Accepted Answer

Thanks! I can write correct code 3 LED flashing using LED1/2/3 or P0_16, P0_17 and P0_7.

posted by Yuji Notsu 14 Oct 2013
11 years, 1 month ago.

https://mbed.org/media/uploads/sam_grove/lpc812_max_schematic_rev3.pdf

"But LED cannot OFF. Why? But I don't know how is define these pin name in mbed compiler."

Maybe there is an error in LEDxx implementation for LPC800. Use port names that you find from the shematic, for example red led is P0_20: DigitalOut myled3(P0_20);