To talk to the LED helper chip you'll need to use our Arduino Adafruit LED Backpack library from github.
To download you can visit the repository, or simply click on this button:
Rename the uncompressed folder Adafruit_LEDBackpack. Check that the Adafruit_LEDBackpack folder contains Adafruit_LEDBackpack.cpp and Adafruit_LEDBackpack.h Place the Adafruit_LEDBackpack library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if it's your first library. We also have a great tutorial on Arduino library installation at:
Rename the uncompressed folder Adafruit_GFX and check that the Adafruit_GFX folder contains Adafruit_GFX.cpp and Adafruit_GFX.h
Place the Adafruit_GFX library folder your arduinosketchfolder/libraries/ folder like you did with the LED Backpack library
It's not actually used for the 7-segment display, it's only for the matrix backpacks but it's still required by the library so please install it to avoid errors! Restart the IDE.
Once you've restarted you should be able to select the File->Examples->Adafruit_LEDBackpack->sevenseg example sketch. Upload it to your Feather as usual. You should see a basic test program that goes through a bunch of different routines.
Once you're happy that the matrix works, you can write your own sketches.
There's a few ways you can draw to the display. The easiest is to just call print - just like you do with Serial
- print(variable,HEX) - this will print a hexidecimal number, from 0000 up to FFFF
- print(variable,DEC) or print(variable) - this will print a decimal integer, from 0000 up to 9999
If you need more control, you can call writeDigitNum(location, number) - this will write the number (0-9) to a single location. Location #0 is all the way to the left, location #2 is the colon dots so you probably want to skip it, location #4 is all the way to the right.
If you want a decimal point, call writeDigitNum(location, number, true) which will paint the decimal point. To draw the colon, use drawColon(true or false)
If you want even more control, you can call writeDigitRaw(location,bitmask) to draw a raw 8-bit mask (as stored in a uint8_t) to that location.
All the drawing routines only change the display memory kept by the Arduino. Don't forget to call writeDisplay() after drawing to 'save' the memory out to the matrix via I2C.
There are also a few small routines that are special to the backpack:
- setBrightness(brightness)- will let you change the overall brightness of the entire display. 0 is least bright, 15 is brightest and is what is initialized by the display when you start
- blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display blinking.