LED Control

Each LED of the controller can be controlled.

 

Things to Prepare

CM-530

 

Theory

The micro controller can control the peripheral devices such as LED connected to the controller through I/O Port. You can control LEDs on the controller using this example.

Refer to controller’s port for port and pin number in 01 LED\app\src\main.c

 

Source

int main(void)

{

/* System Clocks Configuration */

RCC_Configuration();

/* NVIC configuration */

NVIC_Configuration();

/* Configure the GPIO ports */

GPIO_Configuration();

SysTick_Configuration();

 

while(1)

{

GPIO_SetBits(PORT_LED_POWER, PIN_LED_POWER);

GPIO_ResetBits(PORT_LED_MANAGE, PIN_LED_MANAGE);

mDelay(250);

GPIO_SetBits(PORT_LED_MANAGE, PIN_LED_MANAGE);

GPIO_ResetBits(PORT_LED_PROGRAM, PIN_LED_PROGRAM);

mDelay(250);

GPIO_SetBits(PORT_LED_PROGRAM, PIN_LED_PROGRAM);

GPIO_ResetBits(PORT_LED_PLAY, PIN_LED_PLAY);

mDelay(250);

GPIO_SetBits(PORT_LED_PLAY, PIN_LED_PLAY);

GPIO_ResetBits(PORT_LED_TX, PIN_LED_TX);

mDelay(250);

GPIO_SetBits(PORT_LED_TX, PIN_LED_TX);

GPIO_ResetBits(PORT_LED_RX, PIN_LED_RX);

mDelay(250);

GPIO_SetBits(PORT_LED_RX, PIN_LED_RX);

GPIO_ResetBits(PORT_LED_AUX, PIN_LED_AUX);

mDelay(250);

GPIO_SetBits(PORT_LED_AUX, PIN_LED_AUX);

GPIO_ResetBits(PORT_LED_POWER, PIN_LED_POWER);

mDelay(250);

}

return 0;

}

  

 

 

Result

All LEDs will be turned on in order.