Downloading the Arduino Library
We wrote a basic library to help you work with the alphanumeric backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2C-capable micro.
Begin by downloading our Adafruit LED Backpack library and the Adafruit GFX library from the Arduino library manager.
Open up the Arduino library manager:
Search for the Adafruit LED Backpack library and install it
When asked to install dependencies, click Install all.
We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Wiring STEMMA QT Version
Here is an example of the STEMMA QT version wired to a Metro using the STEMMA QT connector on the backpack.
- Board 5V to backpack Vio (red wire)
- Board GND to backpack GND (black wire)
- Board SCL to backpack SCL (yellow wire)
- Board SDA to backpack SDA (blue wire)
Here is an example of the STEMMA QT version wired to a Metro using a solderless breadboard. This example also includes how to wire up the VHi pin, which makes the LEDs appear brighter.
- Board 5V to backpack Vio (long red wire)
- Board GND to backpack GND (black wire)
- Board SCL to backpack SCL (yellow wire)
- Board SDA to backpack SDA (blue wire)
- Backpack VIO to backpack VHi (short red wire)
- Connect CLK to the I2C clock - on Arduino UNO thats Analog #5 (or SCL), on the Leonardo it's Digital #3, on the Mega it's digital #21
- Connect DAT to the I2C data - on Arduino UNO thats Analog #4 (or SDA), on the Leonardo it's Digital #2, on the Mega it's digital #20
- Connect GND to common ground
- Connect VCC+ to power - 5V is best but 3V will work if that's all you've got (it will be dimmer)
- Connect Vi2c to your microcontroller's logic level (3-5V) - If you're using an Arduino, this is almost certainly 5V. If its a 3V Arduino such as a Due, connect it to 3V
Both Vi2c and Vcc MUST be connected to 3 to 5VDC! Vcc is for the LED driver power, Vi2c is what sets the logic level for communication to the chip.
Library Reference
For the quad displays, we have a special object that can handle ascii data for easy printing.You can create the object with
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();
By default, the address is 0x70, but you can pass in the I2C address used when you initialize the display with begin
alpha4.begin(0x70); // pass in the address
alpha4.writeDigitRaw(3, 0x0);
alpha4.writeDigitRaw(0, 0x3FFF);
the 16 bit digit you pass in for raw image has this mapping:
0 DP N M L K J H G2 G1 F E D C B A
The first bit isn't used, you can make it 0 or 1
To turn on just the A segment, use 0x0001
To turn on just the G1 segment, use 0x0040
ASCII data
If you're just looking to print 'text' you can use our font table, just pass in an ASCII character!For example, to set digit #0 to A call:
alpha4.writeDigitAscii(0, 'A')
alpha4.writeDisplay();
Text editor powered by tinymce.