Skip to content

kritishmohapatra/micropython-sevenseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔢 SevenSeg – MicroPython Library for 1-Digit 7-Segment Display

A lightweight, easy-to-use MicroPython library to control single-digit 7-segment displays (common cathode or common anode) on boards like ESP32, ESP8266, and Raspberry Pi Pico 2 W.

MicroPython ESP32 ESP8266 Pico 2 W License PyPI Awesome MicroPython


🚀 Features

  • Supports both Common Cathode & Common Anode types
  • Optional decimal point (dp) control
  • Simple API: show(), clear(), dot()
  • Works on multiple MicroPython boards
  • Clean, modular design for beginners & embedded developers

⚙️ Installation

Copy the sevenseg.py file to your device using Thonny, ampy, or rshell.

Or clone this repo:

git clone https://github.com/kritishmohapatra/micropython-sevenseg.git

# Copy to the root directory of your MicroPython board
sevenseg.py → /

🧠 Pin Diagram (Typical)

 ---a---
|       |
f       b
|       |
 ---g---
|       |
e       c
|       |
 ---d---   ● dp

🧪 Board Examples

Board File Description
ESP32 examples/esp32_basic_counter_example.py Demo on ESP32 with GPIO 23–17
ESP8266 examples/esp8266_basic_counter_example.py Demo on NodeMCU (D1–D8 pins)
Raspberry Pi Pico 2 W examples/rpi_pico_2_w_counter_example.py Demo using GP0–GP7

🧩 Library API

Function Description
show(num) Display a number (0–9)
clear() Turn off all segments
dot(on=True) Turn the decimal point on/off
common_anode Set True for common-anode displays

📦 Folder Structure

micropython-sevenseg/
├── sevenseg/
│   ├── __init__.py
│   └── sevenseg.py
├── examples/
│   ├── sevenseg_esp32_demo.py
│   ├── sevenseg_esp8266_demo.py
│   └── sevenseg_pico2w_demo.py
├── setup.py
├── LICENSE
└── README.md

📜 License

This project is licensed under the MIT License.
© 2025 Kritish Mohapatra – Open Source for MicroPython Community 💡

🔄 What's New in v1.1.0

  • Optimized segment control logic using XOR operation
  • Correct decimal point (DP) behavior for common anode and cathode displays
  • Cleaner and faster pin value handling
  • Community-reviewed improvements

❤️ Contribute

Pull requests are welcome!
If you find a bug or want to suggest an improvement, feel free to open an issue.

🌐 Author

Kritish Mohapatra
🔗 GitHub
📧 kritishmohapatra06norisk@gmail.com

Made with passion for Embedded Systems and MicroPython learners.

About

A lightweight MicroPython library for controlling single-digit 7-segment displays (ESP32, ESP8266, Raspberry Pi Pico W supported).

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages