Adafruit has a nice 4 digit alphanumeric display using 14 segments instead of the normal 7 segments.
You need the Adafruit libraries
The address can be selected via three address jumper pads starting at address 0x70. The following table shows the I2C address depending on the selected jumper pad configuration:
A0 | A1 | A2 |
I2C Address |
open | open | open | 0x70 |
closed | open | open | 0x71 |
open | closed | open | 0x72 |
closed | closed | open | 0x73 |
open | open | closed | 0x74 |
closed | open | closed | 0x75 |
open | closed | closed | 0x76 |
closed | closed | closed | 0x77 |
The display is connected to the I2C bus ports on the bottom of the HelvePic32
The demo code is the default code from Adafruit. Only in the Backpack library, the PROGMEM statement had to be removed and the read call replaced by the direct access to the array. ChipKit memory handling is simpler than the Arduino one.
In the backpack library you have to change the following lines: (original code commented out - line 244)
// uint16_t font = pgm_read_word(alphafonttable+a);
uint16_t font = alphafonttable[a];
Demo Code from Adafruit:
// Demo the quad alphanumeric display LED backpack kit
// scrolls through every character, then scrolls Serial
// input onto the display
#include
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();
void setup() {
Serial.begin(9600);
alpha4.begin(0x70); // pass in the address
alpha4.writeDigitRaw(3, 0x0);
alpha4.writeDigitRaw(0, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(0, 0x0);
alpha4.writeDigitRaw(1, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(1, 0x0);
alpha4.writeDigitRaw(2, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.writeDigitRaw(2, 0x0);
alpha4.writeDigitRaw(3, 0xFFFF);
alpha4.writeDisplay();
delay(200);
alpha4.clear();
alpha4.writeDisplay();
// display every character,
for (uint8_t i='!'; i<='z'; i++) {
alpha4.writeDigitAscii(0, i);
alpha4.writeDigitAscii(1, i+1);
alpha4.writeDigitAscii(2, i+2);
alpha4.writeDigitAscii(3, i+3);
alpha4.writeDisplay();
delay(300);
}
Serial.println("Start typing to display!");
}
char displaybuffer[4] = {' ', ' ', ' ', ' '};
void loop() {
while (! Serial.available()) return;
char c = Serial.read();
if (! isprint(c)) return; // only printable!
// scroll down display
displaybuffer[0] = displaybuffer[1];
displaybuffer[1] = displaybuffer[2];
displaybuffer[2] = displaybuffer[3];
displaybuffer[3] = c;
// set every digit to the buffer
alpha4.writeDigitAscii(0, displaybuffer[0]);
alpha4.writeDigitAscii(1, displaybuffer[1]);
alpha4.writeDigitAscii(2, displaybuffer[2]);
alpha4.writeDigitAscii(3, displaybuffer[3]);
// write it out!
alpha4.writeDisplay();
delay(200);
}