-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from jonnybergdahl/master
Add segment name definitions for alphanumeric displays
- Loading branch information
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// This example shows how to use the alphanumeric segment names in an animation. | ||
// | ||
// Author: Jonny Bergdahl ([email protected]) | ||
// | ||
#include <Arduino.h> | ||
#include <Adafruit_LEDBackpack.h> | ||
|
||
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); | ||
|
||
/* | ||
Segment names for 14-segment alphanumeric displays. | ||
See https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage | ||
-------A------- | ||
|\ | /| | ||
| \ J / | | ||
| H | K | | ||
F \ | / B | ||
| \|/ | | ||
|--G1--|--G2--| | ||
| /|\ | | ||
E / | \ C | ||
| L | N | | ||
| / M \ | | ||
|/ | \| | ||
-------D------- DP | ||
*/ | ||
|
||
uint16_t animation[] { 0, ALPHANUM_SEG_A | ALPHANUM_SEG_D, | ||
1, ALPHANUM_SEG_H | ALPHANUM_SEG_L, | ||
1, ALPHANUM_SEG_N | ALPHANUM_SEG_K, | ||
2, ALPHANUM_SEG_L | ALPHANUM_SEG_H, | ||
2, ALPHANUM_SEG_K | ALPHANUM_SEG_N, | ||
3, ALPHANUM_SEG_A | ALPHANUM_SEG_D, | ||
3, ALPHANUM_SEG_B | ALPHANUM_SEG_C, | ||
3, ALPHANUM_SEG_C | ALPHANUM_SEG_B, | ||
3, ALPHANUM_SEG_D | ALPHANUM_SEG_A, | ||
2, ALPHANUM_SEG_N | ALPHANUM_SEG_K, | ||
2, ALPHANUM_SEG_H | ALPHANUM_SEG_L, | ||
1, ALPHANUM_SEG_K | ALPHANUM_SEG_N, | ||
1, ALPHANUM_SEG_L | ALPHANUM_SEG_H, | ||
0, ALPHANUM_SEG_D | ALPHANUM_SEG_A, | ||
0, ALPHANUM_SEG_E | ALPHANUM_SEG_F, | ||
0, ALPHANUM_SEG_F | ALPHANUM_SEG_E }; | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
alpha4.begin(0x70); // pass in the address | ||
} | ||
|
||
void loop() { | ||
// For each step of the animation, write the value to the given digit | ||
for (int j = 0; j < sizeof(animation)/2; j = j + 2) | ||
{ | ||
alpha4.clear(); | ||
alpha4.writeDigitRaw(animation[j], animation[j+1]); | ||
alpha4.writeDisplay(); | ||
delay(200); | ||
} | ||
} |