I got a new chip and finally made my code work. It is very simple and I can charlieplex up to 306 LED's. I only have a main problem, which is memory space to store the pinArrays (see code below).
PROGMEM sounds like an option, but I haven't been able to make it work, and the other option would be an algorithm... Any suggestions
This is the code. To make it simpler, in this code I only use 4 pins (pin1-4). If you want to use all the pins (pin 1 to pin 19) then both pinArrays are huge and wont fit in my arduino. Any ideas on how to bring this to PROGMEM (yes, I read many times the PROGMEM page on arduino.cc) or to create an algorithm?)
this is the code
int pinArrayh[] = {02,03,04,01,03,04,01,02,04,01,02,03}; //pins high
int pinArrayl[] = {01,01,01,02,02,02,03,03,03,04,04,04}; //pins low
int count = 0;
int timer = 300;
void setup(){
}
void loop() {
for (count=0;count<12;count++) {
pinMode(pinArrayh[count], OUTPUT);
pinMode(pinArrayl[count], OUTPUT);
digitalWrite(pinArrayh[count],HIGH);
digitalWrite(pinArrayl[count],LOW);
delay(timer);
pinMode(pinArrayh[count], INPUT);
pinMode(pinArrayl[count], INPUT);
delay(timer);
}
}