Skip to content

Commit 060386e

Browse files
committed
Added defineChar function and updated examples
1 parent 128dc81 commit 060386e

File tree

4 files changed

+226
-217
lines changed

4 files changed

+226
-217
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**************************************************************************************
2+
* This example redefines some characters of an alphanumeric display.
3+
*
4+
* Written by Gaston Williams
5+
* April 30, 2020
6+
*
7+
* Based on code written by
8+
* Priyanka Makin @ SparkFun Electronics
9+
* Original Creation Date: February 26, 2020
10+
*
11+
* SparkFun labored with love to create this code. Feel like supporting open source hardware?
12+
* Buy a board from SparkFun! https://www.sparkfun.com/products/16426
13+
*
14+
* This code is beerware; if you see me (or any other SparkFun employee) at the
15+
* local, and you've found our code helpful, please buy us a round!
16+
*
17+
* Hardware Connections:
18+
* Attach Red Board to computer using micro-B USB cable.
19+
* Attach Qwiic Alphanumeric board to Red Board using Qwiic cable.
20+
* Don't close any of the address jumpers so that it defaults to address 0x70.
21+
*
22+
* Distributed as-is; no warranty is given.
23+
*****************************************************************************************/
24+
#include <SparkFun_Alphanumeric_Display.h>
25+
HT16K33 display;
26+
27+
void setup() {
28+
Serial.begin(115200);
29+
Serial.println("Qwiic Alphanumeric examples");
30+
Wire.begin(); //Join I2C bus
31+
32+
//check if displays will acknowledge
33+
if (display.begin() == false)
34+
{
35+
Serial.println("Device did not acknowledge! Freezing.");
36+
while(1);
37+
}
38+
Serial.println("Displays acknowledged.");
39+
40+
//Just for demo purposes, show original characters before change
41+
display.print("cafe");
42+
delay(500);
43+
display.print("size");
44+
45+
46+
//Update a, e, f, s and z to new characters
47+
//This change is not permanent, and lasts only for this program.
48+
49+
//define 14 segment bits: nmlkjihgfedcba
50+
display.defineChar('a', 0b01000001011000);
51+
display.defineChar('e', 0b10000001011000);
52+
display.defineChar('f', 0b01010101000000);
53+
display.defineChar('s', 0b00100100001000);
54+
display.defineChar('z', 0b10000001001000);
55+
}
56+
57+
void loop()
58+
{
59+
//Show the new characters
60+
delay(500);
61+
display.print("cafe");
62+
delay(500);
63+
display.print("size");
64+
}

examples/Example7_unkownChar/Example7_unkownChar.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
*
44
* Priyanka Makin @ SparkFun Electronics
55
* Original Creation Date: March 13, 2020
6+
* Updated April 30, 2020 by Gaston Williams - changed exclamation to tab character
67
*
78
* SparkFun labored with love to create this code. Feel like supporting open source hardware?
8-
* Buy a board from SparkFun! https://www.sparkfun.com/products/16391
9+
* Buy a board from SparkFun! LINK GOES HERE
910
*
1011
* This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
1112
* local, and you've found our code helpful, please buy us a round!
@@ -18,7 +19,7 @@
1819
****************************************************************************************/
1920
#include <Wire.h>
2021

21-
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#Alphanumeric_Display by SparkFun
22+
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library:
2223
HT16K33 display;
2324

2425
void setup() {
@@ -34,7 +35,7 @@ void setup() {
3435
}
3536
Serial.println("Display acknowledged.");
3637

37-
display.print("!!!!");
38+
display.print("\t\t\t\t"); //tabs are not printable characters
3839
}
3940

4041
void loop()

0 commit comments

Comments
 (0)