Skip to content

Set of libraries for using Sparkfun seven-segment displays (4 digit), while using different means of communications, implemented as sub-libraries. Based on tutorials @ https://learn.sparkfun.com/tutorials/using-the-serial-7-segment-display

License

Notifications You must be signed in to change notification settings

kigster/sparkfun7SD

Repository files navigation

Sparkfun7SD

Set of libraries for using Sparkfun 7-segment displays (4 digit), but using different means of connectivity as subclasses. It is based on the tutorials published @ https://learn.sparkfun.com/tutorials/using-the-serial-7-segment-display

The hardware

These little displays are very neat and convenient to use, and while not the cheapest, are still pretty affordable at $12.95.

They are mounted on what appears to be a modified Arduino Pro Mini, and support Serial, I2C and SPI interfaces for communications. There are very nice examples and tutorials online, but I wanted to be able to access the display without having to worry which communication protocol to use.

The top level abstract class Sparkfun7SD is responsible for the actual commands sent to the display, while the subclasses are responsible for implementing the appropriate communications protocol.

Protocols currently supported

The library implements:

  • Serial
  • I2C
  • SPI

Whoohoo! :)

Examples

Probably the simplest is the example in the Sparkfun7SD_Serial folder:

#include <Sparkfun7SD_Serial.h>
Sparkfun7SD_Serial display7s(8);  // TX pin 8

void setup() {
    display7s.begin();
    display7s.brightness(255);
}

void loop() {
    display7s.clear();

    display7s.print("1234");
    delay(1000);

    display7s.printTime(12, 30, true);
    delay(1000);
}

To switch from using Serial to I2C, simply edit the first lines. All other usage of the display remains unchanged.

#include <Sparkfun7SD_I2C.h>
Sparkfun7SD_I2C display7s;  // this constructor uses default I2C address 0x71

And to switch to SPI:

#include <Sparkfun7SD_SPI.h>
Sparkfun7SD_SPI display7s;  // this constructor uses default SS pin 8

Contributing

About

Set of libraries for using Sparkfun seven-segment displays (4 digit), while using different means of communications, implemented as sub-libraries. Based on tutorials @ https://learn.sparkfun.com/tutorials/using-the-serial-7-segment-display

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages