Blinky example for STM32 nucleo board
Great!!!
The LED is blinking with:
- include “stm32l0xx.h”
- include “stm32l0xx_nucleo.h”
int main(void)
{
HAL_Init();
// LED clock initialization
LED2_GPIO_CLK_ENABLE();
// Initialize LED
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LED2_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct);
for(;;) {
// HAL_GPIO_TogglePin(LED2_GPIO_PORT,LED_GREEN);
HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN); // Toggle the state of LED2
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_9);
HAL_Delay(400); //delay 100ms
}
}