You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A robust, register-level traffic light control system implemented on the STM32F446RE (Nucleo-64). This project demonstrates a Non-blocking Finite State Machine (FSM) approach to handle car and pedestrian traffic synchronization with real-time button interrupts and rate-limiting logic.
Features
Non-blocking Logic: Uses a global timer reference instead of delay() functions, allowing the MCU to remain responsive.
Finite State Machine (FSM): Clean state transitions (Red -> Yellow -> Green) for both car and pedestrian lanes.
Interrupt-Driven Button: Pedestrian requests are handled via EXTI (External Interrupt) for immediate response.
Smart Rate Limiting: "Anti-vandal" logic ensures the pedestrian button only triggers a phase change once every 60 seconds.
Register-Level Programming: Core peripherals (GPIO, RCC, TIM2, SYSCFG) are configured directly via registers for maximum performance and educational depth.
🛠 Hardware Configuration
Component
MCU Pin
Logic
Function
Car Red LED
PA10
High = ON
Stop signal for cars
Car Yellow LED
PB5
High = ON
Warning signal for cars
Car Green LED
PB4
High = ON
Go signal for cars
Pedestrian Red LED
PC0
High = ON
Stop signal for pedestrians
Pedestrian Green LED
PC1
High = ON
Go signal for pedestrians
Pedestrian Button
PB0
Pull-up
Active Low (Interrupt)
⏱ Timing Logic
The system operates on a Global Time Reference principle. Instead of halting the processor, we calculate the time elapsed since a state started.