Skip to content

shubhamkumarrk13/stm32-press-counter-led-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Press Counter with LED Codes (STM32 NUCLEO-F446RE)

A bare-metal STM32 firmware project that counts button presses and displays the count using LED blink codes.

This project is implemented using direct register manipulation without HAL libraries.


Project Overview

The firmware has two operating phases.

Phase 1 — Counting

  • Press the onboard button between 1 and 9 times.
  • Every valid press produces a short LED flash.
  • If no button is pressed for approximately two seconds, the firmware switches to display mode.

Phase 2 — Display

The LED blinks back the number of recorded button presses.

Example

If the button was pressed four times:

Blink

Blink

Blink

Blink

Pause

Repeat

During display mode, pressing the button resets the counter and returns the firmware to counting mode.


Hardware

  • STM32 NUCLEO-F446RE
  • USB Cable

No external hardware is required.


Pin Mapping

Function Pin
LED PA5
Button PC13

Concepts Demonstrated

  • Register-level GPIO programming
  • Memory-mapped I/O
  • RCC clock enabling
  • Active LOW button logic
  • Polling
  • Software debouncing
  • Edge detection
  • Timeout detection
  • Counter variables
  • Two-phase state machine
  • LED data encoding

Software Architecture

COUNTING
    |
    | 2 seconds without button press
    V
DISPLAYING
    |
    | Button Press
    V
COUNTING

Build Instructions

  1. Open STM32CubeIDE
  2. Create a project for the NUCLEO-F446RE
  3. Replace Core/Src/main.c
  4. Build
  5. Flash
  6. Run

Folder Structure

stm32-press-counter-led-codes
│
├── README.md
├── .gitignore
├── docs
│   └── wiring.md
└── src
    └── main.c

Future Improvements

  • Timer interrupts
  • UART output
  • Seven-segment display
  • LCD interface
  • Persistent storage

About

Bare-metal STM32 project demonstrating button press counting, timeout detection, state machines, and LED blink-code feedback using direct register access.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages