wrightmac
Published © CC BY-SA

What's in a Library? Let's Learn!

This an article for the noobs & the newly initiated into the Arduino World. What is in a library, what it's used for, and how to find stuff.

BeginnerProtip622
What's in a Library? Let's Learn!

Things used in this project

Hardware components

8x32 HT1632C LED Matrix
×1
ELEGOO UNO R3 Board ATmega328P ATMEGA16U2 with USB Cable
ELEGOO UNO R3 Board ATmega328P ATMEGA16U2 with USB Cable
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE
nano - *nix editor

Story

Read more

Schematics

8x32 + Arduino Schematic

For this demo

Code

8x32 Demo Code

Arduino
An example with lots of comments.
// Libraries needed for the demo
#include <HT1632.h>
#include <font_5x4.h>

// Set the variables
// integers
int i = 0;
int wd;

// a string of characters to display
char disp [] = "Welcome to TVLand!";

void setup () {
  // Which pins is the display using. 
  // The pin order is (CS1, pinWR, pinDATA)
  HT1632.begin(9, 10, 11);

  // Setting up the font
  wd = HT1632.getTextWidth(disp, FONT_5X4_END, FONT_5X4_HEIGHT);
}

void loop () {
  // Original code - drawTarget not a keyword
  // HT1632.drawTarget(BUFFER_BOARD(1));
  // Below, renderTarget, reflects the updated library - v2.0,
  // which screen to send the data to. There can be up to 4 panels.
  HT1632.renderTarget(1);
  
  // Clear the RAM buffer for the display
  HT1632.clear();
  
  // OUT_SIZE, FONT_5X4, FONT_5X4_END, FONT_5X4_HEIGHT
  // All of the above variables come from the font.h file
  // OUT_SIZE is the width of the display
  HT1632.drawText(disp, OUT_SIZE - i, 2, FONT_5X4, FONT_5X4_END, FONT_5X4_HEIGHT);
  
  // Display the contents of RAM to the screen
  HT1632.render();

  // Scrolling the text from right to left
  i = (i+1)%(wd + OUT_SIZE);

  // a quick pause before cycling through
  delay(100);
}

Credits

wrightmac
16 projects • 22 followers
Network geek by day, apprentice hardware hacker by night, curious-tinkerer always, and Apple Fanboy since 1984!

Comments