Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add segment name definitions for alphanumeric displays #76

Merged
merged 5 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Adafruit_LEDBackpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@

#define SEVENSEG_DIGITS 5 ///< # Digits in 7-seg displays, plus NUL end

#define ALPHANUM_SEG_A 0b0000000000000001 ///< Alphanumeric segment A
#define ALPHANUM_SEG_B 0b0000000000000010 ///< Alphanumeric segment B
#define ALPHANUM_SEG_C 0b0000000000000100 ///< Alphanumeric segment C
#define ALPHANUM_SEG_D 0b0000000000001000 ///< Alphanumeric segment D
#define ALPHANUM_SEG_E 0b0000000000010000 ///< Alphanumeric segment E
#define ALPHANUM_SEG_F 0b0000000000100000 ///< Alphanumeric segment F
#define ALPHANUM_SEG_G1 0b0000000001000000 ///< Alphanumeric segment G1
#define ALPHANUM_SEG_G2 0b0000000010000000 ///< Alphanumeric segment G2
#define ALPHANUM_SEG_H 0b0000000100000000 ///< Alphanumeric segment H
#define ALPHANUM_SEG_J 0b0000001000000000 ///< Alphanumeric segment J
#define ALPHANUM_SEG_K 0b0000010000000000 ///< Alphanumeric segment K
#define ALPHANUM_SEG_L 0b0000100000000000 ///< Alphanumeric segment L
#define ALPHANUM_SEG_M 0b0001000000000000 ///< Alphanumeric segment M
#define ALPHANUM_SEG_N 0b0010000000000000 ///< Alphanumeric segment N
#define ALPHANUM_SEG_DP 0b0100000000000000 ///< Alphanumeric segment DP

/*!
@brief Class encapsulating the raw HT16K33 controller device.
*/
Expand Down
42 changes: 42 additions & 0 deletions examples/quadalphaanimation/quadalphaanimation.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 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();
// Defines the animation. For segment names,
// see https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage
uint16_t animation[] { 0, ALPHANUM_SEG_A,
1, ALPHANUM_SEG_H,
1, ALPHANUM_SEG_N,
2, ALPHANUM_SEG_L,
2, ALPHANUM_SEG_K,
3, ALPHANUM_SEG_A,
3, ALPHANUM_SEG_B,
3, ALPHANUM_SEG_C,
3, ALPHANUM_SEG_D,
2, ALPHANUM_SEG_N,
2, ALPHANUM_SEG_H,
1, ALPHANUM_SEG_K,
1, ALPHANUM_SEG_L,
0, ALPHANUM_SEG_D,
0, ALPHANUM_SEG_E,
0, ALPHANUM_SEG_F };

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);
}
}