Arduino library for controlling seven-segment displays
- Contents
- Features
- Changelog
- Installation
- Quick Start
- Documentation
Digit(byte a_pin, byte b_pin, byte c_pin, byte d_pin, byte e_pin, byte f_pin, byte g_pin, byte dp_pin)
- Description - ParametersDigit.displayMessage(String str, unsigned int delay_ms)
- Description - ParametersDigit.display(int num, boolean decimal = false)
- Description - ParametersDigit.display(char c, boolean period = false)
- Description - ParametersDigit.clear()
- Description
- display representations of numbers, letters, and punctuation on a seven-segment display
- control multiple displays for more complex arrangements
- compatible with Arduino
v1.0 - 5/24/20
- first release
copy Digit.h
and Digit.cpp
into a folder called Digit
to the Arduino libraries
folder and it should appear in the libraries list.
Digit can display the following characters:
Numbers
- 0123456789
Letters
- AabCcdEeFGHhIiJLlnOoPpqrSstUuYy
Punctuation
- (space)
- " (double quote)
- ' (single quote)
- = (equals)
- . (period)
- - (dash)
- _ (underscore)
Example Setup
Segment names
Setup on breadboard
Example Code
#include "Digit.h"
Digit digit(2,3,4,5,6,7,8,9); // init Digit object
void setup()
{
}
void loop()
{
// hello!
digit.displayMessage("HELLO.", 500);
// count to nine
for (int i = 0; i < 10; i++) {
digit.display(i);
delay(1000);
digit.clear();
}
// loop thru all possible chars
digit.displayMessage("0123456789 AabCcdEeFGHhIiJLlnOoPpqrSstUuYy \"'=.-_", 300);
}
Digit(byte a_pin, byte b_pin, byte c_pin, byte d_pin, byte e_pin, byte f_pin, byte g_pin, byte dp_pin)
- initialize Digit object
- a_pin - (byte) pin number for the a segment
- b_pin - (byte) pin number for the b segment
- c_pin - (byte) pin number for the c segment
- d_pin - (byte) pin number for the d segment
- e_pin - (byte) pin number for the e segment
- f_pin - (byte) pin number for the f segment
- g_pin - (byte) pin number for the g segment
- dp_pin - (byte) pin number for the decimal point segment
- displays message one char at a time separated by the delay
- str - (String) message to display
- delay_ms (unsigned int) delay in ms
- display a single number with optional decimal point
- num - (int) number to display
- decimal = (boolean) show the decimal point or not. Default:
false
- display a single char with optional period
- c - (char) char to display
- period - (boolean) show the period or not. Default:
false
- clear the display