Arduino Uno

Header

Corner
-->

Multi digit 7 segement display library

I wrote this library out of 2 reasons:

  1. None of the existings libraries worked as expected.
  2. All existing libraries were bound to a specific timer.

As you may conclude out of this, you need to implement the timer yourself or, and this is what I did, use some of the existing timer libraries. I've been using "MsTimer2" (see the link below).

Downloads

 Multi7s 0.02

 Multi7s 0.01

Example code

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <MsTimer2.h>
#include <Multi7s.h>

// define the pins where the digits are connected to
byte digitPins[] = {9, 10, 11, 12}; // LSB to MSB
// define the pins where the segments are connected to
byte segmentPins[] = {2, 3, 4, 5, 6, 7, 8}; // seg a to g

// create a new object
Multi7s multi7s(4,digitPins,segmentPins);

void setup()
{
  // initialise the timer: give it the intervall and the update method 
  MsTimer2::set(multi7s.getTimerIntervall(), updateDisplay); 
  // start the timer
  MsTimer2::start();
}

// define the update method
void updateDisplay()
{
  multi7s.displayNext();
}

void loop()
{
  // change the value each second
  multi7s.setValue(millis()/1000);
}

Links

 MsTimer2 Library