Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************************
- This is a library for our I2C LED Backpacks
- Designed specifically to work with the Adafruit 16x8 LED Matrix backpacks
- ----> http://www.adafruit.com/products/2035
- ----> http://www.adafruit.com/products/2036
- ----> http://www.adafruit.com/products/2037
- ----> http://www.adafruit.com/products/2038
- ----> http://www.adafruit.com/products/2039
- ----> http://www.adafruit.com/products/2040
- ----> http://www.adafruit.com/products/2041
- ----> http://www.adafruit.com/products/2042
- ----> http://www.adafruit.com/products/2043
- ----> http://www.adafruit.com/products/2044
- ----> http://www.adafruit.com/products/2052
- These displays use I2C to communicate, 2 pins are required to
- interface. There are multiple selectable I2C addresses. For backpacks
- with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
- with 3 Address Select pins: 0x70 thru 0x77
- Adafruit invests time and resources providing this open source code,
- please support Adafruit and open-source hardware by purchasing
- products from Adafruit!
- Written by Limor Fried/Ladyada for Adafruit Industries.
- BSD license, all text above must be included in any redistribution
- ****************************************************/
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include "Adafruit_LEDBackpack.h"
- Adafruit_8x16matrix matrix = Adafruit_8x16matrix();
- void setup() {
- Serial.begin(9600);
- Serial.println("jerry");
- matrix.begin(0x70); // pass in the address
- }
- static const uint8_t PROGMEM
- Full_bmp[] =
- { B11111111,
- B11111111,
- B11111111,
- B11111111,
- B11111111,
- B11111111,
- B11111111,
- B11111111 },
- X_bmp[] =
- { B10000001,
- B11000011,
- B11100111,
- B11111111,
- B11111111,
- B11100111,
- B11000011,
- B10000001 },
- square_bmp[] =
- { B11111111,
- B10000001,
- B10000001,
- B10000001,
- B10000001,
- B10000001,
- B10000001,
- B11111111 },
- smsquare_bmp[] =
- { B00000000,
- B00000000,
- B00111100,
- B00111100,
- B00111100,
- B00111100,
- B00000000,
- B00000000 };
- void loop() {
- matrix.clear();
- matrix.drawBitmap(0, 0, Full_bmp, 8, 8, LED_ON);
- matrix.drawBitmap(0, 8, X_bmp, 8, 8, LED_ON);
- matrix.writeDisplay();
- delay(1000);
- matrix.clear();
- matrix.drawBitmap(0, 8, smsquare_bmp, 8, 8, LED_ON);
- matrix.drawBitmap(0, 0, square_bmp, 8, 8, LED_ON);
- matrix.writeDisplay();
- delay(1000);
- matrix.clear();
- matrix.drawBitmap(0, 0, smsquare_bmp, 8, 8, LED_ON);
- matrix.drawBitmap(0, 8, Full_bmp, 8, 8, LED_ON);
- matrix.writeDisplay();
- delay(1000);
- matrix.clear();
- matrix.drawBitmap(0, 8, Full_bmp, 8, 8, LED_ON);
- matrix.drawBitmap(0, 0, square_bmp, 8, 8, LED_ON);
- matrix.writeDisplay();
- delay(1000);
- matrix.clear(); // clear display
- matrix.drawPixel(6, 10, LED_ON);
- matrix.writeDisplay(); // write the changes we just made to the display
- delay(1000);
- matrix.clear();
- matrix.drawLine(0,0,15,15, LED_ON);
- matrix.drawLine(0,15,15,0, LED_ON);
- matrix.writeDisplay(); // write the changes we just made to the display
- delay(1000);
- matrix.clear();
- matrix.drawRect(15,15, 0,0, LED_ON);
- matrix.fillRect(0,1, 0,0, LED_ON);
- matrix.writeDisplay(); // write the changes we just made to the display
- delay(1000);
- matrix.clear();
- matrix.drawCircle(3,3, 3, LED_ON);
- matrix.drawCircle(12,12, 3, LED_ON);
- matrix.writeDisplay(); // write the changes we just made to the display
- delay(1000);
- 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>=-64; x--) {
- matrix.clear();
- matrix.setCursor(x,0);
- matrix.print("Hello");
- matrix.writeDisplay();
- delay(50);
- }
- matrix.setTextSize(1);
- matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
- matrix.setTextColor(LED_ON);
- matrix.setRotation(1);
- for (int8_t x=7; x>=-36; x--) {
- matrix.clear();
- matrix.setCursor(x,0);
- matrix.print("World");
- matrix.writeDisplay();
- delay(100);
- }
- matrix.setRotation(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement