[last updated: 2020-09-15]
go to: 7-segment LED home page
Adafruit 877 - backpack driver
Adafruit 865 - 0.56" 4-digit 7-segment display
go to: used in - compost temperature meter
go to: used in first prototype of - wall clock/timer
-----
This module (Adafruit: 878) is the 7-segment, 4-digit module (Adafruit 865)
plus the backpack control module (Adafruit 877)
-------------------------------------
Adafruit 878
Adafruit 878
backpack connection pins
- The standard 4-digit, 7-segment LED module has 14 pins (see: 7-segment LED module). This makes it I/O-intensive to implement, so Adafruit and others have a "backpack" module that attaches to the back of the LED module and provides an i2C interface that only requires 4 pins (power, ground, data, & clock) to address the LED module digits.
- The I2c address for the module is configurable with on-board jumpers. There are three jumpers, open by default, but can be bridged/shorted. They're labeled: A0, A1, and A2. If they're open, they have a value of 0, and if shorted, a value of 1.
Default address is 0x70. Final address is 0x70 + A0 + (A1 * 2) + (A2 * 4)
- In order for it to compile, I had to install the Adafruit LED Backpack Library, as well as the Adafruit GFX Library
- Writing data to the display:
Initialize display with: clockDisplay.begin(0x70);
("clockDisplay" is your choice of names for this instance of the display)
Writing to the display requires 2 commands:
First: write to the buffer, with a variety of command options as listed below,
Then: flush the buffer to the display with:
clockDisplay.writeDisplay();
- Write the whole display at once:
- This writes an integer with println:
clockDisplay.println(1234);
- This writes 4 hex characters:
clockDisplay.print(0xABCD, HEX);
- This writes a decimal integer:
clockDisplay.print(1234, DEC);
- This writes a floating point number:
clockDisplay.print(45.03);
- Write one digit at a time:
- If writing digits directly, the left-most digit is digit '0', colon is '2', and right-most digit is digit '4'
- This writes a single integer to a specified digit (digit '0' in this example):
clockDisplay.writeDigitNum(0, 9);
- This writes an integer bitmask into (eg.) digit '0':
clockDisplay.writeDigitRaw(0, bitmask);
- The bitmask is calculated:
segment 'A' = 1
segment 'B' = 2
segment 'C' = 4
segment 'D' = 8
segment 'E' = 16
segment 'F' = 32
segment 'G' = 64
decimal point 'DP' = 128
- So for example to write segments 'A'. 'B', 'F', and 'G', a small circle in top half of the digit that might be used to signify a temperature "degree" symbol,
bitmask = 1 + 2 + 32 + 64 = 99
clockDisplay.writeDigitRaw(0, 99);
- This clears/blanks (eg.) digit '3':
clockDisplay.writeDigitRaw(3, 0);
- This writes the colon:
clockDisplay.drawColon(true); Turn it off with "false"
eof