Hallo an Alle!
ich habe hier mal ein Problem und zwar habe ich einige Arrays in Progmem gespeichert aber weiß nicht so recht, an welcher Stelle ich genau den pgm_read Befehl ansetzen soll.
Auch welcher der pgm Befehle der richtige ist, hab ich auch so meine Probleme (da das Array ein uint_16 ist, gehe ich davon aus, dass ich den pgm_read_word_near Befehl nehme…?).
Ebenso ein kleines Rätsel ist auch die Verwendung von const und static, eigentlich reicht doch die Verwendung eines der Beiden, oder? Zumindest gabs keine Fehlermeldung wenn Beides drin steht…aber das ist nur ne Frage am Rande.
Hauptsache ich bekomm progmem ausgelesen und die Daten nacheinander auf der LED Matrix angezeigt, was er wahrscheinlich bisher nicht macht, da die Matrix schwarz bleibt. Die Arrays sind selbsterklärend fürs Forum etwas gekürzt. Pro Bild/Array sind es 2048 Pixel.
Mein Programm:
// ----------------------------
// Standard Libraries - Already Installed if you have ESP8266 set up
// ----------------------------
#include <Ticker.h>
#include <PxMatrix.h>
// The library for controlling the LED Matrix
// Needs to be manually downloaded and installed
// https://github.com/2dom/PxMatrix
Ticker display_ticker;
// Pins for LED MATRIX
#define P_LAT 16
#define P_A 5
#define P_B 4
#define P_C 15
#define P_OE 2
#define P_D 12
#define P_E 0
// PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C);
// PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);
PxMATRIX display(64, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D);
// This is a horribly inefficient way of drawing this, but meh.. :)
// Converted using the following site: http://www.rinkydinkelectronics.com/t_imageconverter565.php
const PROGMEM uint16_t bar1[] = {
0xF800, 0xF800, 0xF800, 0xF800, 0xF800, 0xF800, 0x0000, 0x0000, 0x0000, 0xF800, 0xF800, 0xF800, 0xF800, 0x0000, 0x0000, 0xF800, // 0x0010 (16) pixels
0xF800, 0xF800, 0xF800, 0xF800, 0xF800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0020 (32) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0030 (48) pixels
0x0000, 0x6B0C, 0xFFDF, 0xAD34, 0x6B0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0040 (64) pixels [...]
};
const PROGMEM uint16_t static bar2[] = {
0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0x0000, 0x0000, 0x0000, 0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0x0000, 0x0000, 0xDCC0, // 0x0010 (16) pixels
0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0xDCC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0020 (32) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0030 (48) pixels [...]
};
const PROGMEM uint16_t static bar3[] = {
0xF7E0, 0xF7E0, 0xF7E0, 0xF7E0, 0xF7E0, 0xF7E0, 0x0000, 0x0000, 0x0000, 0xF7E0, 0xF7E0, 0xF7E0, 0xF7E0, 0x0000, 0x0000, 0xF7E0, // 0x0010 (16) pixels [...]
.
.
.
// ISR for display refresh
void display_updater() {
display.display(70);
}
void setup() {
display.begin(16);
display.clearDisplay();
display_ticker.attach(0.002, display_updater);
yield();
}
void drawFrame( const uint16_t *frame) {
display.clearDisplay();
int imageHeight = 32;
int imageWidth = 64;
int counter = 0;
for (int yy = 0; yy < imageHeight; yy++) {
for (int xx = 0; xx < imageWidth; xx++) {
display.drawPixel(xx, yy, frame[counter]);
counter++;
}
}
delay(100);
}
void loop() {
drawFrame(bar1); delay(1000);
drawFrame(bar2);
drawFrame(bar3);
yield();
};
Kann mir da wer helfen?
schöne Grüße