| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /***************************************************
- This is a library for our I2C LED Backpacks
- Designed specifically to work with the Adafruit LED Matrix backpacks
- ----> http://www.adafruit.com/products/872
- ----> http://www.adafruit.com/products/871
- ----> http://www.adafruit.com/products/870
- 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"
- #ifndef _BV
- #define _BV(bit) (1<<(bit))
- #endif
- Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();
- uint8_t counter = 0;
- void setup() {
- Serial.begin(9600);
- Serial.println("HT16K33 test");
-
- matrix.begin(0x70); // pass in the address
- }
- void loop() {
- // paint one LED per row. The HT16K33 internal memory looks like
- // a 8x16 bit matrix (8 rows, 16 columns)
- for (uint8_t i=0; i<8; i++) {
- // draw a diagonal row of pixels
- matrix.displaybuffer[i] = _BV((counter+i) % 16) | _BV((counter+i+8) % 16) ;
- }
- // write the changes we just made to the display
- matrix.writeDisplay();
- delay(100);
- counter++;
- if (counter >= 16) counter = 0;
- }
|