Region text is full. Time interrupt?

Hi!

I’ve got the message that Region text is full, which makes me think that I must rewrite the code…
However, I don’t know how to do it by myself, so I would appreciate your advice and/or sample codes…

What I’m trying to do is to control 6x6 LED matrix by 6+6 Darlington power transistors, which are connected to pins on Arduino board. I did not use the LED driver since I have 6 more LEDs connected in parallel to each of the basic of the above mentioned 6x6 LEDs. It takes more current than for usual LED drivers. The 6x6x6 LED cube display should work as 2D matrix (with an “extruded” 3rd dimension), by turning on and off the LEDs if the sent characters from the computer are capital or small…

So, I’m trying to build my own “driver” from transistors, by having if…else blocks…
I use an OpenGL PPM program as an input. It maps changes on images like a chess-board but 6x6 and sends characters like ‘A’-‘Z’ and ‘1’-‘0’ for activated fields and ON, and ‘a’-‘z’ and ‘!’-’=’. for OFF.
I used this encoding scheme since it’s easier for me to debug it if something goes wrong…but still, there are 72 if else-s…

Here I attach the sample of code…I would like to make it faster, like real display works, by using the time interrupt function and sort of “scannning” one line, but I’m not sure how to do that. I guess six of the pins should be acting as “bus”, but I don’t know how to program that when I use not bits, but characters…

Please help, I need the prototype to work properly for my thesis presentation on friday …

Thank you in advance,

Tatjana

//columns
int Pin1= 13;
int Pin2= 12;
int Pin3= 11;
int Pin4= 10;
int Pin5= 9;
int Pin6= 8;
//rows
int Pin7 = 7;
int Pin8 = 6;
int Pin9 = 5;
int Pin10= 4;
int Pin11= 3;
int Pin12= 2;
int val;
int serialGet = 0; //value from the serial port
int delaytime = 1; //for the main loop
void setup() {
pinMode(Pin1, OUTPUT);
pinMode(Pin2, OUTPUT);
pinMode(Pin3, OUTPUT);
pinMode(Pin4, OUTPUT);
pinMode(Pin5, OUTPUT);
pinMode(Pin6, OUTPUT);
pinMode(Pin7, OUTPUT);
pinMode(Pin8, OUTPUT);
pinMode(Pin9, OUTPUT);
pinMode(Pin10, OUTPUT);
pinMode(Pin11, OUTPUT);
pinMode(Pin12, OUTPUT);
beginSerial(9600);
Serial.println("Startup ");
}
void loop()
{
if (Serial.available() > 0) {
serialGet = serialRead(); //read the serial port
if (serialGet != -1) { //if the input is -1, then there is no data
val = serialGet; //otherwise store it
Serial.println(val);
}
}
//first of the three boards, 12 LEDs controlled by 2 + 6 pins connected to transistors
//control by pins 1 & 2 matching the same values with pins 7-12)
//charactersON { A, B, G, H, M, N, S, T, Y, Z, 5, 6}
//charactersOFF { a, b, g, h, m, n, s, t, y, z, %, &}
if (val == ‘A’) {
digitalWrite(Pin1, 0);
digitalWrite(Pin7, 0);
val = 0;
} else if(val == ‘a’) {
digitalWrite(Pin1, 1);
digitalWrite(Pin7, 1);
val = 0;
} if (val == ‘B’) {
digitalWrite(Pin2, 0);
digitalWrite(Pin7, 0);
val = 0;
} else if(val == ‘b’) {
digitalWrite(Pin2, 1);
digitalWrite(Pin7, 1);
val = 0;
}if (val == ‘G’) {
digitalWrite(Pin1, 0);
digitalWrite(Pin8, 0);
val = 0;
} else if(val == ‘g’) {
digitalWrite(Pin1, 1);
digitalWrite(Pin8, 1);
val = 0;
} if (val == ‘H’) {
digitalWrite(Pin2, 0);
digitalWrite(Pin8, 0);
val = 0;
} else if(val == ‘h’) {
digitalWrite(Pin2, 1);
digitalWrite(Pin8, 1);
val = 0;
} if (val == ‘M’) {
digitalWrite(Pin1, 0);
digitalWrite(Pin9, 0);
val = 0;
} else if(val == ‘m’) {
digitalWrite(Pin1, 1);
digitalWrite(Pin9, 1);
val = 0;
}
// etc…//

} if (val == ‘0’) {
digitalWrite(Pin6, 0);
digitalWrite(Pin12, 0);
val = 0;
} else if(val == ‘=’) {
digitalWrite(Pin6, 1);
digitalWrite(Pin12, 1);
val = 0;
}
delay(delaytime);
}