Is anyone here working by any chance working with Arduino ?
So I bought a 8x8 Matrix LED, and I hooked it up with my Arduino, everything was cool, downloaded the needed libraries for the backpack and for the GTX.
So pretty much the backpack works with 4pins:
- CLK (l2C clock)
- DAT (l2C data)
- GND
- VCC+ (5V or 3V)
Connected everything, installed the libraries successfully. Tested it all the sketches and examples and they worked perfect.
But here comes the problem so when I started creating my own patterns for the 8x8 matrix with code i came up with errors..
Now while I was writing my code I was looking at what the original code of course so I could reference if any errors come up.
Also so you could understand what actually the patern_bmp[] are, they are basically the 8x8 Matrix LED mapping for the LED's.#include <Wire.h> #include "Adafruit_LEDBackpack.h" #include "Adafruit_GTX.h" Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); void setup() { Serial.begin(9600); Serial.println("8x8 LED Matrix Test"); matrix.begin(0x70); } static const uint8_t PROGMEM patern_bmp[] = { B01010101, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000 }, patern2_bmp[] = } B01010101, B10101010, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000 }, patern3_bmp[] = } B01010101, B10101010, B01010101, B00000000, B00000000, B00000000, B00000000, B00000000 }, patern4_bmp[] = } B01010101, B10101010, B01010101, B10101010, B00000000, B00000000, B00000000, B00000000 }, patern5_bmp[] = } B01010101, B10101010, B01010101, B10101010, B01010101, B00000000, B00000000, B00000000 }, patern6_bmp[] = } B01010101, B10101010, B01010101, B10101010, B01010101, B10101010, B00000000, B00000000 }, patern7_bmp[] = } B01010101, B10101010, B01010101, B10101010, B01010101, B10101010, B01010101, B00000000 }, patern8_bmp[] = } B01010101, B10101010, B01010101, B10101010, B01010101, B10101010, B01010101, B10101010 }; void loop() { matrix.clean(); matrix.dawBitmap(0, 0, patern_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern2_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern3_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern4_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern5_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern6_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern7_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); matrix.clean(); matrix.dawBitmap(0, 0, patern8_bmp, 8, 8, LED_ON); matrix.writeDisplay(); delay(500); }
1 means ON, 0 means OFF, so am technically mapping right there how to LED's are going to switch ON and in what pattern.
Here are the errors I got:
'class Adafruit_8x8matrix' has no member named 'drawBitmap' In file included from sketch_aug01a.ino:2: C:\Users\user\Documents\Arduino\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:32:26: error: Adafruit_GFX.h: No such file or directory sketch_aug01a.ino:3:26: error: Adafruit_GTX.h: No such file or directory In file included from sketch_aug01a.ino:2: C:\Users\user\Documents\Arduino\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:94: error: expected class-name before '{' token C:\Users\user\Documents\Arduino\libraries\Adafruit_LEDBackpack/Adafruit_LEDBackpack.h:103: error: expected class-name before '{' token sketch_aug01a.ino: In function 'void loop()': sketch_aug01a:107: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:107: error: 'neutral_bmp' was not declared in this scope sketch_aug01a:112: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:117: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:122: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:127: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:132: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:137: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap' sketch_aug01a:142: error: 'class Adafruit_8x8matrix' has no member named 'drawBitmap'
Now what really really confuses me is that first of all that the command drawBitmap was taken from the example of the already pre-made arduino 8x8matrix sketches.
I have also double checked that i have included all the libraries needed, and came across a very interesting thing.
The PROGMEM is actually a command that stores data in flash (program) memory instead of using SRAM. The PROGMEM keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go.
And the PROGMEM is part of the pgmspace.h library, so that means that we need to include the library at the top your sketch #include <avr/pgmspace.h>.
I have tried doing that and nothing happen, the weird thing is that non of the presets that came with the Adafruit code/library had that library included but they all had the command static const uint8_t PROGMEM. I do not understand why would this command work in first place if the library is not included/invoked, but it is anyway.
Shouldn't I get an error saying that static const uint8_t PROGMEM is not valid, because the library is not included??
And also why am i getting an error that there's no such directort/file as Adafruit_LEDBackpack or Adafruit_GTX.h when i have them clearly, if I did not I would not be able to even upload the given sketches in first place.
Any help is really appreciated!!