0% found this document useful (0 votes)
104 views6 pages

STM32 Traffic Light Control

Ideas for STM 32 project

Uploaded by

turkarudit85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views6 pages

STM32 Traffic Light Control

Ideas for STM 32 project

Uploaded by

turkarudit85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Design Challenge-01: To Create a Traffic Light system using Stm32 Bluepill

Procedure Step 1 : Open Stm32CubeIde


Step 2 : Click on File-- >> New-- >> Stm32 Project

Step 3 : Now Enter Commercial Part Number which is present on the Stm32
Board and Press Enter.
Step 4 : Give File name and Press Finish.

Step 5 : Click on System core -- >> SYS

Step 6 : On Debug Select ‘Serial Wire’

Step 7 : Select the Required GPIO Port on Pinout View as output.


Step 8 : Now Press Ctrl+S to Save
Step 9 : Now Press on the Dialog box

Step 10 : In “ Main.c “ file , write the code in while(1){ } Block

Step 11 : Now click on the Build (Hammer) Icon to debug the code
Step 12 : After debug Click on the Run Icon /Green Play button to run the project

.
Step 13 : A Configuration panel will pops up if not then go manually by pressing on
run configuration.

Step 14 : Set Build configuration to Debug

Step 15 : Click on Debugger

Step 16 : Set the Degub Probe on Open OCD

Step 17 : Press on Show Generation


Step 18 : Now On Mode Setup >> Reset Mode Set to Software System Reset

Step 19 : Press on Apply then OK to run the Program


Step 20 : After Successfully Running of Program, Disconnect and Reconnect the V-
LINK from the Computer
while (1)
Program {
// Red
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
HAL_Delay(2000);

// Green
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
HAL_Delay(2000);

// Orange
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
HAL_Delay(1000);
}
Schematic

You might also like