hab mir jetzt mal diesen Sketch zusammengebastelt...
ist ursprünglich einer für eine 8x8 Matrix....
CodeBox C
const int col[5]={2,3,4,5,6};
const int row[7]={7,8,9,10,11,12,13};
int pixels[5][7];
int count = 1000;
char str[]="FABCDEDCBA";
int strLen = sizeof(str);
int ptrChar = 0;
typedef bool charMapType[5][7];
const charMapType charBlank = {
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0)
};
const charMapType grossO = {
(0,0,1,0,0),
(0,1,0,1,0),
(1,0,0,0,1),
(1,0,0,0,1),
(1,0,0,0,1),
(0,1,0,1,0),
(0,0,1,0,0)
};
const charMapType kleinx = {
(0,0,0,0,0),
(0,0,0,0,0),
(1,0,0,0,1),
(0,1,0,1,0),
(0,0,1,0,0),
(0,1,0,1,0),
(1,0,0,0,1)
};
const charMapType kleiny = {
(0,0,0,0,0),
(0,0,0,0,0),
(0,1,0,0,1),
(0,1,0,0,1),
(0,1,1,1,1),
(0,0,0,0,1),
(0,1,1,1,1)
};
const charMapType kleing = {
(0,0,0,0,0),
(0,0,0,0,0),
(0,1,1,1,0),
(1,0,0,0,1),
(0,1,1,1,1),
(0,0,0,0,1),
(0,1,1,1,0)
};
const charMapType kleine = {
(0,0,0,0,0),
(0,0,0,0,0),
(0,1,1,1,0),
(1,0,0,0,1),
(1,1,1,1,0),
(1,0,0,0,0),
(0,1,1,1,0)
};
const charMapType kleinn = {
(0,0,0,0,0),
(0,0,0,0,0),
(0,0,0,0,0),
(1,0,1,1,0),
(1,1,0,0,1),
(1,0,0,0,1),
(1,0,0,0,1)
};
const charMapType *charMap[7] = {&grossO, &kleinx, &kleiny, &kleing, &kleine, &kleinn,
&charBlank};
void setup() {
for(int colPin = 2;colPin < 6;colPin++){
pinMode(col[colPin], OUTPUT);
for(int rowPin = 7;rowPin < 13;rowPin++){
pinMode(row[rowPin], OUTPUT);
digitalWrite(col[colPin], HIGH);
}
}
setupChar();
}
void loop() {
refreshScreen();
if (count-- == 0){
count = 1000;
setupChar();
}
}
void setupChar(){
char c = str[ptrChar];
int offset = c - 'A';
const charMapType *cMap = charMap[offset];
for (int x = 0;x < 5; x++){
for (int y = 0;y < 7; y++){
bool v = (*cMap)[x][y];
if(v){
pixels[x][y] = LOW;
}else{
pixels[x][y] = HIGH;
}
}
}
ptrChar++;
if(ptrChar>strLen-1){
ptrChar = 0;
}
}
void refreshScreen(){
for (int thisRow = 0; thisRow < 7; thisRow++){
digitalWrite(row[thisRow], HIGH);
for (int thisCol = 0; thisCol < 5; thisCol++){
int thisPixel = pixels[thisRow][thisCol];
digitalWrite(col[thisCol], thisPixel);
if (thisPixel == LOW) {
digitalWrite(col[thisCol], HIGH);
}
}
digitalWrite(row[thisRow], LOW);
}
}
EDIT: Ich habe den Code in die Codebox gesetzt, dann lässt es sich besser lesen, Dirk