Get more code examples on our github: Adafruit-LED-Backpack-Library
Download: file
#include <avr/power.h>
#include <TinyWireM.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();

char *message = "**3D** 4 LIFE***    ";


void setup() {
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  alpha4.begin(0x70);  // pass in the address
  alpha4.writeDisplay();  // clear display
}

void loop() {
  // just display 4 letters
  alpha4.writeDigitAscii(0, 'H');
  alpha4.writeDigitAscii(1, 'A');
  alpha4.writeDigitAscii(2, 'C');
  alpha4.writeDigitAscii(3, 'K');
  alpha4.writeDisplay();
  delay(1000); // hold for 1 second

  // scroll the message above!
  for (uint8_t i=0; i<strlen(message)-4; i++) {
    alpha4.writeDigitAscii(0, message[i]);
    alpha4.writeDigitAscii(1, message[i+1]);
    alpha4.writeDigitAscii(2, message[i+2]);
    alpha4.writeDigitAscii(3, message[i+3]);
    alpha4.writeDisplay();
    delay(500);
  }
}

This guide was first published on Jun 23, 2014. It was last updated on Jun 23, 2014.

This page (Code) was last updated on Dec 05, 2020.