Moving Beyond the Ordinary With the Qwiic Alphanumeric Display
The Basics
Let’s start at the very beginning, a very good place to start. Once you’ve installed the library, you’ll be able to access all of our example code. Navigate your way to File/Examples/SparkFun Qwiic Alphanumeric Display Arduino Library/Example_01_PrintString, open it and upload it to your microcontroller. If all goes as expected, your display should be showing the work “Milk” for all to see! (Why “Milk”? Eh, why not? It’s four characters in length, shows the use of both uppercase and lowercase letters, and, well, I suppose our engineer likes milk!)
/*****************************************************************************************
* This example tests illuminating whole 4 letter strings on the 14-segment display.
*
* Priyanka Makin @ SparkFun Electronics
* Original Creation Date: February 3, 2020
*
* SparkFun labored with love to create this code. Feel like supporting open source hardware?
* Buy a board from SparkFun! https://www.sparkfun.com/products/16391
*
* This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
* local, and you've found our code helpful, please buy us a round!
*
* Hardware Connections:
* Attach Red Board to computer using micro-B USB cable.
* Attach Qwiic Alphanumeric board to Red Board using Qwiic cable.
*
* Distributed as-is; no warranty is given.
****************************************************************************************/
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_Alphanumeric_Display by SparkFun
HT16K33 display;
void setup()
{
Serial.begin(115200);
Serial.println("SparkFun Qwiic Alphanumeric - Example 1: Print String");
Wire.begin(); //Join I2C bus
if (display.begin() == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while (1);
}
Serial.println("Display acknowledged.");
display.print("Milk");
}
void loop()
{
}
If you feel like the bright lights of the Alphanumeric Display aren’t enough to capture the attention of passersby, there’s always the option of adding a little motion to your message. Our library has a built-in function, shiftLeft() (or shiftRight()), that slides your message across the displays. Run File/Examples/SparkFun Qwiic Alphanumeric Display Arduino Library/Example_09_ScrollingString to see it in action.
/**************************************************************************************
* This example tests scrolling functionality of alphanumeric displays.
*
* Priyanka Makin @ SparkFun Electronics
* Original Creation Date: February 26, 2020
*
* SparkFun labored with love to create this code. Feel like supporting open source hardware?
* Buy a board from SparkFun! https://www.sparkfun.com/products/16391
*
* This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
* local, and you've found our code helpful, please buy us a round!
*
* Hardware Connections:
* Attach Red Board to computer using micro-B USB cable.
* Attach Qwiic Alphanumeric board to Red Board using Qwiic cable.
* Don't close any of the address jumpers so that it defaults to address 0x70.
* Attach a second Alphanumeric display using Qwiic cable.
* Close address jumper A0 so that this display's address become 0x71.
*
* Distributed as-is; no warranty is given.
*****************************************************************************************/
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_Alphanumeric_Display by SparkFun
HT16K33 display;
void setup() {
Serial.begin(115200);
Serial.println("SparkFun Qwiic Alphanumeric - Example 9: Scrolling String");
Wire.begin(); //Join I2C bus
//check if displays will acknowledge
if (display.begin(0x70) == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while(1);
}
Serial.println("Displays acknowledged.");
display.print("MILK");
delay(500);
}
void loop()
{
delay(300);
display.shiftLeft();
//Alternatively - you could also shift the string to the right
//display.shiftRight();
}