8X8 LED Animation_Helen Hyungou Jo

VIDEO_8X8 LED

Code

#include <Wire.h>
#include “Adafruit_LEDBackpack.h”
#include “Adafruit_GFX.h”

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
Serial.begin(9600);
Serial.println(“8×8 LED Matrix Test”);

matrix.begin(0x70); // pass in the address
}

static const uint8_t PROGMEM
smile_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10100101,
B10011001,
B01000010,
B00111100 },
neutral_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10111101,
B10000001,
B01000010,
B00111100 },
frown_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10011001,
B10100101,
B01000010,
B00111100 };

void loop() {
matrix.clear();
matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_ON);
matrix.writeDisplay();
delay(500);

matrix.clear();
matrix.drawBitmap(0, 0, neutral_bmp, 8, 8, LED_ON);
matrix.writeDisplay();
delay(500);

matrix.clear();
matrix.drawBitmap(0, 0, frown_bmp, 8, 8, LED_ON);
matrix.writeDisplay();
delay(500);

matrix.clear(); // clear display
matrix.drawPixel(0, 0, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);

matrix.clear();
matrix.drawLine(0,0, 7,7, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);

matrix.clear();
matrix.drawRect(0,0, 8,8, LED_ON);
matrix.fillRect(2,2, 4,4, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);

matrix.clear();
matrix.drawCircle(3,3, 3, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);

matrix.setTextSize(1);
matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
matrix.setTextColor(LED_ON);
for (int8_t x=0; x>=-36; x–) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print(“OOOO”);
matrix.writeDisplay();
delay(100);
}
matrix.setRotation(3);
for (int8_t x=7; x>=-36; x–) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print(“—-“);
matrix.writeDisplay();
delay(100);
}
matrix.setRotation(0);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s