{"id":26583120,"url":"https://github.com/beckversync/stm32-traffic-light-and-clock-simulation","last_synced_at":"2025-10-08T11:11:51.705Z","repository":{"id":256533397,"uuid":"855563276","full_name":"Beckversync/STM32-Traffic-Light-and-Clock-Simulation","owner":"Beckversync","description":"Simulating and controlling LEDs and a 7-segment display using an STM32 microcontroller are modeled and tested in Proteus. The system evolves from simple LED toggling to a complete clock display with multiple LEDs and a countdown timer, offering practical insights into microcontroller-based digital control systems.","archived":false,"fork":false,"pushed_at":"2025-03-05T12:02:57.000Z","size":7345,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T01:40:13.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Beckversync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-11T04:35:55.000Z","updated_at":"2025-07-10T08:49:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"6247c987-23be-40e9-bdb7-bc8a94c40f7f","html_url":"https://github.com/Beckversync/STM32-Traffic-Light-and-Clock-Simulation","commit_stats":null,"previous_names":["beckversync/lab1_hcmut_241","beckversync/stm32-traffic-light-and-clock-simulation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Beckversync/STM32-Traffic-Light-and-Clock-Simulation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beckversync%2FSTM32-Traffic-Light-and-Clock-Simulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beckversync%2FSTM32-Traffic-Light-and-Clock-Simulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beckversync%2FSTM32-Traffic-Light-and-Clock-Simulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beckversync%2FSTM32-Traffic-Light-and-Clock-Simulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beckversync","download_url":"https://codeload.github.com/Beckversync/STM32-Traffic-Light-and-Clock-Simulation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beckversync%2FSTM32-Traffic-Light-and-Clock-Simulation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278931654,"owners_count":26070789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-23T08:20:27.340Z","updated_at":"2025-10-08T11:11:51.680Z","avatar_url":"https://github.com/Beckversync.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌟 STM32 Traffic Light and Clock Simulation 🌟\n\nThis project includes multiple exercises to simulate and control LEDs and a 7-segment display using an STM32 microcontroller, modeled and tested in Proteus. The exercises build up from simple LED toggling to a complete clock display with multiple LEDs and a countdown timer.\n\n## 📖 Table of Contents\n- [💡 Exercise 1: LED Control](#exercise-1-led-control)\n- [🚦 Exercise 2: Traffic Light Simulation](#exercise-2-traffic-light-simulation)\n- [🔄 Exercise 3: 4-Way Traffic Light](#exercise-3-4-way-traffic-light)\n- [7️⃣ Exercise 4: 7-Segment Display](#exercise-4-7-segment-display)\n- [⏳ Exercise 5: Traffic Light with Countdown](#exercise-5-traffic-light-with-countdown)\n- [🕒 Exercise 6: Analog Clock Simulation](#exercise-6-analog-clock-simulation)\n- [🧹 Exercise 7: Clear All LEDs](#exercise-7-clear-all-leds)\n- [🎯 Exercise 8: Set LED by Number](#exercise-8-set-led-by-number)\n- [🚫 Exercise 9: Clear LED by Number](#exercise-9-clear-led-by-number)\n- [⏰ Exercise 10: Complete Clock Display](#exercise-10-complete-clock-display)\n\n## 💡 Exercise 1: LED Control\n**Objective:** Connect two LEDs to STM32 and toggle their states every 2 seconds.\n- **Components:** 🟥 RED LED (PA5), 🟨 YELLOW LED (PA6)\n- **Report:**\n  1. 📝 Schematic from Proteus with link to project file\n  2. 🧑‍💻 Source code for the LED toggle in an infinite loop\n\n## 🚦 Exercise 2: Traffic Light Simulation\n**Objective:** Add a 🟩 GREEN LED (PA7) and simulate a simple traffic light sequence.\n- **Cycle:** 🟥 RED (5s), 🟨 YELLOW (2s), 🟩 GREEN (3s)\n- **Report:**\n  1. 📝 Schematic from Proteus\n  2. 🧑‍💻 Source code for the traffic light sequence\n\n## 🔄 Exercise 3: 4-Way Traffic Light\n**Objective:** Simulate a 4-way traffic light system using 12 LEDs arranged as shown in the reference design.\n- **Report:**\n  1. 📝 Schematic of the 4-way traffic light\n\n## 7️⃣ Exercise 4: 7-Segment Display\n**Objective:** Connect a 7-segment common anode display to STM32 (PB0 to PB6) and implement the `display7SEG(int num)` function.\n- **Behavior:** Display numbers 0–9 by setting appropriate LED segments\n- **Report:**\n  1. 📝 Schematic including the 7-segment display\n  2. 🧑‍💻 Source code for the `display7SEG` function\n\n## ⏳ Exercise 5: Traffic Light with Countdown\n**Objective:** Integrate the 7-segment display into the 4-way traffic light to show a countdown timer.\n- **Report:**\n  - 🧑‍💻 Source code only (re-using the `display7SEG` function)\n\n## 🕒 Exercise 6: Analog Clock Simulation\n**Objective:** Arrange 12 LEDs to represent an analog clock face (PA4 to PA15) and create a program to light them up sequentially.\n- **Report:**\n  1. 📝 Schematic of the clock face\n  2. 🧑‍💻 Source code to light LEDs in sequence\n\n## 🧹 Exercise 7: Clear All LEDs\n**Objective:** Implement the `clearAllClock()` function to turn off all LEDs representing the clock face.\n- **Report:**\n  - 🧑‍💻 Source code for `clearAllClock()`\n\n## 🎯 Exercise 8: Set LED by Number\n**Objective:** Implement the `setNumberOnClock(int num)` function to turn on a specific LED.\n- **Report:**\n  - 🧑‍💻 Source code for `setNumberOnClock(int num)`\n\n## 🚫 Exercise 9: Clear LED by Number\n**Objective:** Implement the `clearNumberOnClock(int num)` function to turn off a specific LED.\n- **Report:**\n  - 🧑‍💻 Source code for `clearNumberOnClock(int num)`\n\n## ⏰ Exercise 10: Complete Clock Display\n**Objective:** Combine all previous functions to create a working analog clock display with 12 LEDs for hour, minute, and second hands.\n- **Behavior:** Only 3 LEDs light up at any given time for hour, minute, and second.\n- **Report:**\n  - 🧑‍💻 Source code for the complete clock implementation\n\n---\n\n**🛠 Tools:**\n- 🖥 STM32 Microcontroller\n- 🧪 Proteus for simulation\n- 📚 HAL library for STM32 programming\n\n**🚀 How to Use:**\n1. 🌀 Clone this repository.\n2. 📝 Open the provided Proteus simulation files.\n3. 🔥 Flash the provided STM32 code onto your board.\n4. 👀 Follow each exercise’s instructions and observe the expected behavior.\n\n**👥 Contributors:**\n- 🧑‍💻 Beckversync\n\n**📜 License:**\nHCMUT\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeckversync%2Fstm32-traffic-light-and-clock-simulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeckversync%2Fstm32-traffic-light-and-clock-simulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeckversync%2Fstm32-traffic-light-and-clock-simulation/lists"}