This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
projects:a4sim:hardware:ht16k33ledmodule:start [2019/10/18 18:23] admin |
projects:a4sim:hardware:ht16k33ledmodule:start [2020/02/22 17:07] (current) admin ↷ Links adapted because of a move operation |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Requires Adafruit driver, which includes I2C sending. **Note:** This has to be run from an Arduino. | Requires Adafruit driver, which includes I2C sending. **Note:** This has to be run from an Arduino. | ||
| - | [[lowdependencyexample|Low Dependency Example]] | + | * [[lowdependencyexample|Low Dependency Example]] |
| + | * https:// | ||
| [[https:// | [[https:// | ||
| + | {{ a4sim: | ||
| ==== Example code ==== | ==== Example code ==== | ||
| * [[arduinoadafruitexample|Adafruit Arduino Example]] | * [[arduinoadafruitexample|Adafruit Arduino Example]] | ||
| - | |||
| - | <code c++> | ||
| - | / | ||
| - | This is a library for our I2C LED Backpacks | ||
| - | |||
| - | Designed specifically to work with the Adafruit LED Matrix backpacks | ||
| - | ----> http:// | ||
| - | ----> http:// | ||
| - | ----> http:// | ||
| - | |||
| - | These displays use I2C to communicate, | ||
| - | 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/ | ||
| - | BSD license, all text above must be included in any redistribution | ||
| - | | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | #include " | ||
| - | |||
| - | Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); | ||
| - | |||
| - | void setup() { | ||
| - | Serial.begin(9600); | ||
| - | Serial.println(" | ||
| - | | ||
| - | matrix.begin(0x70); | ||
| - | } | ||
| - | |||
| - | 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, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawBitmap(0, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawBitmap(0, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawPixel(0, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawLine(0, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawRect(0, | ||
| - | matrix.fillRect(2, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.clear(); | ||
| - | matrix.drawCircle(3, | ||
| - | matrix.writeDisplay(); | ||
| - | delay(500); | ||
| - | |||
| - | matrix.setTextSize(1); | ||
| - | matrix.setTextWrap(false); | ||
| - | matrix.setTextColor(LED_ON); | ||
| - | for (int8_t x=0; x>=-36; x--) { | ||
| - | matrix.clear(); | ||
| - | matrix.setCursor(x, | ||
| - | matrix.print(" | ||
| - | matrix.writeDisplay(); | ||
| - | delay(100); | ||
| - | } | ||
| - | matrix.setRotation(3); | ||
| - | for (int8_t x=7; x>=-36; x--) { | ||
| - | matrix.clear(); | ||
| - | matrix.setCursor(x, | ||
| - | matrix.print(" | ||
| - | matrix.writeDisplay(); | ||
| - | delay(100); | ||
| - | } | ||
| - | matrix.setRotation(0); | ||
| - | } | ||
| - | </ | ||