9 years, 7 months ago.

how can change digital led out at other bit? what is "led1" means in program (blink -led)?

program (blink -led)

  1. include "mbed.h"

DigitalOut myled(LED1);

int main() { while(1) { myled = 1; LED is ON wait(0.2); 200 ms myled = 0; LED is OFF wait(1.0); 1 sec } }

Question relating to:

1 Answer

9 years, 7 months ago.

LED1 is the name of one of the LED's on the mbed board. - I think every mbed board has a LED connected to a port pin. Inside the mbed lib this name LED1 is defined to the corresponding port bit. For the ST F401 it is PA_5. This is not perfect, because there is also the clock of SPI1 and if you use this the LED will glow. If you want to use a different port pin you simply have to change the DigitalOut definition. DigitalOut myled(PC_8) With this declaration the pin up-right will blink - if connected to a resistor and a LED.