Use 3 pins of Arduino to control multiple 7-segment display with 4094 8-bit shift register.
It has been tested on HEF4094B
CD4094B
CD4094BM
and MC74HCT4094A
.
- Display upto 255 seven-segment digits
- Display number (Negative, Float)
- Display alphabets (char array)
- Common anode and cathode displays
- Clear the display
- Download the library as ZIP file
- Arduino IDE > Sketch > Include Library > Add .ZIP Library > Select "Arduino-shiftRegister4094SevenSeg.ZIP"
- Arduino IDE > File > Examples > Arduino-shiftRegister4094SevenSeg > SimpleDisplay
- Data pin: D pin on shift register.
- Clock pin: CLK or CP pin on shift register.
- Strobe pin: STR on pin shift register.
-
shiftRegister4094SevenSeg()
shiftRegister4094SevenSeg newObject(bool type, uint8_t digit_num);
Create shiftRegister4094SevenSeg object (can be more than one), segment type and number of 7-segment digit.
type
: segment type, can beCATHODE
(true) orANODE
(false).digit_num
: number of digit, can be between 0 to 255.
Example:
shiftRegister4094SevenSeg myDisplay(CATHODE, 4); // Common Cathode with 4 digit display
-
begin()
begin(uint8_t data_pin, uint8_t clock_pin, uint8_t strobe_pin);
Initializes the library with communication pins which are connected to Arduino in
setup()
.Example:
void setup(){ myDisplay.begin(2, 3, 4); }
-
print()
Using
print()
function to print the data to the digits. Print funstion always starts from theleft digit
andturn all off
when the data is too long to fit the digits.- Print one character (A-Z)
myDisplay.print(char cha);
- Print integer value (positive or negative)
myDisplay.print(int value);
- Print long value (positive or negative)
myDisplay.print(long value);
- Print float value (Default). Ex 2.34
myDisplay.print(float value);
- Print float with specific number of decimals. Ex. 234.7
myDisplay.print(float value, int dec);
- Print string array. Ex. "A45U"
myDisplay.print(char str[]);
-
clear()
Using
clear()
function to turn off all digit (everything).myDisplay.clear();
-
allOn()
Using
allOn()
function to turn on all digit include the dot.myDisplay.allOn();
- Alignment, left or right.
- Print at specific digit.
- Clear specific digit, could be multiple digit. Ex. clear(from, to).
- Blink specific digit, could be multiple digit. Ex. blink(from, to).
- Testing to see issues.
Email: theara729@gmail.com
Web: www.etronicskh.com.