Okay fellas, we have mixed news!
The good! I got it to upload again, i found my short in the whole thing (had to leave ~10 leds disconnected due to the short!)
Here's a video, and it will help to visualize the problem that I explain below.
When the video goes black, that's when there is only a couple lights that light up very dimly.
The bad- Well only about 1/2 or less than that LEDS are actually lighting up....
I realized another problem with the programming though, and that was that I actually had 14 sets of wires, giving me a total of 182 leds.
After a while of the program running, it will hang in a spot. It is generally the same spot (the same lights light up).
Only one light should be on at a time, not really sure why there's a lot of them (could be a short, but I tested for conductivity, is there any modifications that could be made in the programming?)
the
I think the program gets confused or overloaded after a while, it stops and only a HARD reboot (unplug and replug) will solve the problem. If I hit reset the leds stop flickering and go solid, but then when I let go they go back to flickering.
This is the final code that I'm using at the moment;
#include <avr/io.h>
#include <avr/pgmspace.h>
unsigned char cathodes[182] PROGMEM = {1,2,3,4,5,6,7,8,9,10,11,12,13, 0,2,3,4,5,6,7,8,9,10,11,12,13, 0,1,3,4,5,6,7,8,9,10,11,12,13, 0,1,2,4,5,6,7,8,9,10,11,12,13, 0,1,2,3,5,6,7,8,9,10,11,12,13, 0,1,2,3,4,6,7,8,9,10,11,12,13, 0,1,2,3,4,5,7,8,9,10,11,12,13, 0,1,2,3,4,5,6,8,9,10,11,12,13, 0,1,2,3,4,5,6,7,9,10,11,12,13, 0,1,2,3,4,5,6,7,8,10,11,12,13, 0,1,2,3,4,5,6,7,8,9,11,12,13, 0,1,2,3,4,5,6,7,8,9,10,12,13, 0,1,2,3,4,5,6,7,8,9,10,11,13, 0,1,2,3,4,5,6,7,8,9,10,11,12};
unsigned char cathodes[182] PROGMEM = {0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8, 9,9,9,9,9,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11,11,11,11,11, 12,12,12,12,12,12,12,12,12,12,12,12,12, 13,13,13,13,13,13,13,13,13,13,13,13,13};
int pin0 = 0;
int pin1 = 1;
int pin2 = 2;
int pin3 = 3;
int pin4 = 4;
int pin5 = 5;
int pin6 = 6;
int pin7 = 7;
int pin8 = 8;
int pin9 = 9;
int pin10 = 10;
int pin11 = 11;
int pin12 = 12;
int pin13 = 13;
int time = 50;
int totalLEDS = 182;
int n = 0;
int whichled = 0;
int last_n = 0;
int pickone = 0;
void setup(){
pinMode(0, INPUT);
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
}
void light_cp_led(int whichone){
static unsigned char last_n = 0;
pinMode(cathodes[last_n], INPUT); // turn off previous LED
pinMode(anodes[last_n], INPUT); // on both ends
pinMode(cathodes[whichone], OUTPUT); // turn on new LED cathode
digitalWrite(cathodes[whichone], LOW);
pinMode(anodes[whichone], OUTPUT); // turn on new LED anode
digitalWrite(anodes[whichone], HIGH);
last_n = whichone;
}
void loop()
{
static unsigned char whichled = 0;
delay(time); // Wait
light_cp_led(whichled);
whichled += 1; // Pick next led
if (whichled >= totalLEDS) { // Did we run out of LEDs?
whichled = 0; // If so, go back to first LED.
}
}
This is definitely an improvement over yesterday though!!!!!!!