Skip to content

Instantly share code, notes, and snippets.

@boxalljohn
Created August 1, 2013 05:58
Show Gist options
  • Save boxalljohn/6128730 to your computer and use it in GitHub Desktop.
Save boxalljohn/6128730 to your computer and use it in GitHub Desktop.
// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
int z;
void setup()
{
// start the matrix at I2C address - default is 0x70
matrix.begin(0x70); // pass in the address
}
void loop()
{
matrix.clear(); // clear display
for (z=0; z<8; z++)
{
matrix.drawPixel(z, 0, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(50);
matrix.drawPixel(z, 0, LED_OFF);
matrix.writeDisplay(); // write the changes we just made to the display
}
for (z=0; z<8; z++)
{
matrix.drawPixel(7, z, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(50);
matrix.drawPixel(7, z, LED_OFF);
matrix.writeDisplay(); // write the changes we just made to the display
}
for (z=7; z>=0; --z)
{
matrix.drawPixel(z, 7, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(50);
matrix.drawPixel(z, 7, LED_OFF);
matrix.writeDisplay(); // write the changes we just made to the display
}
for (z=7; z>=0; --z)
{
matrix.drawPixel(0, z, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(50);
matrix.drawPixel(0, z, LED_OFF);
matrix.writeDisplay(); // write the changes we just made to the display
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment