The Adafruit Seven-Segment LED Backpack 1.2 Inch Digits Yellow is a user-friendly display module designed for displaying alphanumeric characters in a highly visible format. This component is ideal for projects requiring a simple, bright, and clear numeric display, such as clocks, counters, and readouts for sensors.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VCC | Power supply (3.5V to 5.5V) |
3 | SDA | I2C Data line |
4 | SCL | I2C Clock line |
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>
Adafruit_7segment matrix = Adafruit_7segment();
void setup() {
matrix.begin(0x70); // Initialize the display with its I2C address
}
void loop() {
matrix.print(1234); // Display the number 1234
matrix.writeDisplay(); // Refresh the display with new data
delay(5000); // Wait for 5 seconds
// Display a hexadecimal number
matrix.print(0xBEEF, HEX);
matrix.writeDisplay();
delay(5000);
}
i2cdetect
utility to confirm the device's address on the I2C bus.Q: Can I change the brightness of the display?
A: Yes, you can adjust the brightness using the setBrightness(uint8_t b)
function, where b
is a value between 0 (dim) and 15 (bright).
Q: How do I display characters other than numbers? A: The Adafruit LED Backpack library provides functions to display a limited set of characters and symbols. Refer to the library documentation for more details.
Q: Can I use this display with a 3.3V microcontroller? A: Yes, the display can be powered with 3.5V to 5.5V, but ensure that the logic levels for I2C communication are compatible with your microcontroller.