Reference | All - Docs - Libraries - Soft Processors - Cores


Multiplex7SegSw is a library that allows you to multiplex upto 8 7-segment digits using any one of the pins on your arduino.

This library is derived from the original hardware timer based Multiplex7SegSW library provide with the Arduino IDE, though it removes dependence on hardware timer and provides a pure Arduino code to operate a 5-digit 7-segment display. No periodic function is called automatically, so the main application must call the Multiplex7SegSW::update() function in the loop()

This library also introduces a subset of ASCII character set so that the user can pass ASCII strings to the library. It is of course, not possible to display every character on a standard 7-segment character block, so some special symbols are provided in these places.

Currently ASCII characters 0x20 through 0x5A (space through capital-Z) are supported, while some character codes in the range are used for special symbols that can be used to create certain combinations on the 7-segment display. Please refer to character map for details.

This library was intended for the LogicStart MegaWing 2.0 demo and also supports LogicStart MegaWing 2.1 which activates the colon and apostrophe. It may be used with any other 7-segment setup by mapping the pins appropriately.

The colon and apostrophe on the 7-segment display used on LogicStart MegaWing are mapped into 5th digit as follows:

colon: segments a (L1) and b (L2)
apostrophe: segment c (L3)

While the character table implements them accordingly, they must be used only for the 5th digit. Use on any other digits will not render the intended result.






/* Display a temperature value by scaling the ADC readout by 100
and placing the decimal point at proper position.
The units are also displayed by setting the apostrophe on and
adding the unit 'C' for centigrade as [ C ] after the value

#include <Multiplex7SegSW>;

#define noOfDigits 5
byte digitPins[] = {11, 8, 2, 0, 28}; // LSB to MSB
byte segmentPins[] = {7, 10, 5, 6, 3, 4, 9, 1}; // seg a to g and DP
int var;

Multiplex7SegSW sevenseg1;

void setup()
sevenseg1.set(1, noOfDigits, digitPins, segmentPins);

void loop()
var = analogRead(); // Read temperature
// Scale the analog value
var *= 100;
sevenseg1.loadValue(var, 3, ALIGN_LEFT);
sevenseg1.setDecimalPoint(2, true);
sevenseg1.writeChar(3, 'F');


This text is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Some of the text is from the Arduino reference.


Share |