9 months ago.

PwmOut sample code doesn't work on LED1 on STM32-L432KC

I have a Nucleo STM32-L432KC board.

I'm trying to build the example PwmOut sketch on mbed.com:

[code] Gradually change the intensity of the LED.

include "mbed.h" PwmOut led(LED1);

int main() { while(1) { led = led + 0.01; wait(0.2); if(led >= 1.0) { led = 0; } } } [/code]

This program is from the help page of the PwmOut object. (The only thing I changed was the == 1.0 to >= 1.0) When I download this and flash it with openocd, the LED does not light up.

When I use a simple DigitalOut program, the LED does light up, so presumably the flashing works right.

Download command: [code]openocd -f ./stm32-nucleo-l432kc.cfg -c 'program Downloads/Nucleo_blink_led.NUCLEO_L432KC.bin 0x08000000 reset exit'[/code]

Comment on this question

1 Answer