Piyush Kumar Singh
Published

Three LEDs blink in various combinations

BLinking Three LEDs in various combinations using stm32F401CCU6 and STM32 CubeIDE

BeginnerFull instructions provided9
Three LEDs blink in various combinations

Things used in this project

Hardware components

STM32F401CCU6
×1
LED (generic)
LED (generic)
×1

Story

Read more

Code

Coding the LED Sequence

C/C++
#include "main.h"

void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

int main(void)
{
  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();

  while (1)
  {
    // Pattern 100
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6 | GPIO_PIN_7, GPIO_PIN_RESET);
    HAL_Delay(500); // Delay 500 ms

    // Add other patterns here following the same structure
    // ...

    // Pattern 110
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5 | GPIO_PIN_6, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_RESET);
    HAL_Delay(500); // Delay 500 ms
  }
}

Credits

Piyush Kumar Singh

Piyush Kumar Singh

4 projects • 0 followers

Comments