Playing around with an adafruit 16x8 matrix was hoping to run it using a Digistump.
Using the example available from the adafruit library, I get the following mess when trying to compile:
In file included from C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library\examples\matrix16x8\matrix16x8.ino:31:0:
C:\Users\rolle\Documents\Arduino\libraries\Adafruit_GFX_Library/Adafruit_GFX.h:107:25: error: '__FlashStringHelper' does not name a type
getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
^
C:\Users\rolle\Documents\Arduino\libraries\Adafruit_GFX_Library/Adafruit_GFX.h:107:46: error: ISO C++ forbids declaration of 's' with no type [-fpermissive]
getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
^
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).
I'm using the default example, but I'll post the code here:
/***************************************************
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("16x8 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, 8, 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,15, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.clear();
matrix.drawRect(0,0, 8,16, LED_ON);
matrix.fillRect(2,2, 4,12, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.clear();
matrix.drawCircle(3,8, 3, LED_ON);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.setTextSize(2);
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(100);
}
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(0);
}
I have a feeling that the digistump might not be able to do this, but I'm not a coder, I just kinda mash stuff together with the hope that it works. Any advice? I read in a different post that the references to __FlashStringHelper needed to be commented out, but that resulted in an entirely new mess.
In file included from C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library\examples\matrix16x8\matrix16x8.ino:31:0:
C:\Users\rolle\Documents\Arduino\libraries\Adafruit_GFX_Library/Adafruit_GFX.h:111:3: error: expected unqualified-id before 'virtual'
virtual size_t write(uint8_t);
^
matrix16x8:34: error: cannot allocate an object of abstract type 'Adafruit_8x16matrix'
Adafruit_8x16matrix matrix = Adafruit_8x16matrix();
^
In file included from C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library\examples\matrix16x8\matrix16x8.ino:32:0:
C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:94:7: note: because the following virtual functions are pure within 'Adafruit_8x16matrix':
class Adafruit_8x16matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
^
In file included from C:\Users\rolle\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Stream.h:24:0,
from C:\Users\rolle\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/TinyDebugSerial.h:31,
from C:\Users\rolle\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/WProgram.h:18,
from C:\Users\rolle\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Arduino.h:4,
from sketch\matrix16x8.ino.cpp:1:
C:\Users\rolle\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Print.h:73:20: note: virtual size_t Print::write(uint8_t)
virtual size_t write(uint8_t) = 0;
^
matrix16x8:34: error: cannot declare variable 'matrix' to be of abstract type 'Adafruit_8x16matrix'
Adafruit_8x16matrix matrix = Adafruit_8x16matrix();
^
In file included from C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library\examples\matrix16x8\matrix16x8.ino:32:0:
C:\Users\rolle\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:94:7: note: since type 'Adafruit_8x16matrix' has pure virtual functions
class Adafruit_8x16matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
^
exit status 1
cannot allocate an object of abstract type 'Adafruit_8x16matrix'