SSDisplay
7-Segment Display (SSDisplay)

Introduction

SSDisplay is a library to control common-cathode and common-anode 7-segment displays directly from Arduino without any external integrated circuit. At first, it implements the main functionalities of a LED 7-segment display, controlling digits and decimal points exhibition. However, you may extend SSDisplay to meet your needs, given that it has similarity with template-method pattern. Thus, you can override the hook methods onShow() and onHide() to extend its functionalities when LEDs turn on or off, respectively. This is useful if your display has peculiarities like colons or apostrophe.

Keep in mind that the main aim of this library is prototyping and study. Furthermore, such a project doesn't use third party libraries and is compliant with PlatformIO requirements.

Features

  • Brightness adjust

      

  • Suppression of leading zeros

      

  • Display blink with tuning of interval

         >>>+200 ms  

  • Alphanumeric characters
Characters A B C D E F G H h I J L N O P R S U Z
Exhibition

Only H letter is case sensitive.

Special Characters [( ]) -
Exhibition


Basic usage

{c++}
#include <SSDisplay.hpp>
using RAW::Display::SSDisplay;
using RAW::Display::Warning;
// pin numbers for digits
byte digits[] = {41,39,35};
/* pin numbers for segments. If the display has decimal point, this array must be 8.
The first pin is the decimal point, second pin is A segment, third is B segment and so son.
*/
byte segments[] = {45, 43, 33, 31, 47, 27, 37, 29};
// Creates a common-cathode display with 3 digits and 7 segments plus decimal point.
SSDisplay display(3, digits, 8, segments, true);
void setup()
{
// adjust the brightness in 20% of capacity.
Warning wrn=display.setBrightness(20);
// causing display overflow because display has 3 digits.
wrn|=display.write("Hello.");
// is there some warning?
if(wrn!=Warning::NO_WRN){
// write Hi.
display.write("Hi.");
}
}
void loop()
{
// Calling the update method.
display.update();
}

For more examples, see the example folder. And look at the docs for more details.

Changelog

For changelogs, see Releases.