I don't understand what your code is doing, nor do I ever see you set the output values for port C pins (this is the port that has the analog inputs on it).
I'm sorry about that, and sorry for my english too, I'm from Chile. This is my first experience with code and arduino. I'm starting from 0; My code works fine. I made it simpler and hopefully it will be easier to understand. This code is part of a bigger code to make a Knight Rider with 144 LED's. There MUST be easier ways but I am a beginner and it's hard for me already trying to fix my own code. My only problem right now is that I cannot turn ON the LED's connected to the analog Pins.
Just to put this code in context, I am running 144 leds with charlieplexing. The way I am doing this is setting one pin (ex: digital pin 2) as OUTPUT/HIGH and go through all the others to OUTPUT/LOW.
Then I go to the next pin (ex: digital pin 3) as OUPUT/HIGH and go through all the others, one by one from INPUT to OUTPUT/LOW.
It goes through all the pins turning them on and inmediately off, like the Knight Rider example.
All LED and charlieplexed.
I haven't set the values of the C pins because I don't know how to do this. I tried though. What I dont understand is why my code works from pin 7-13 and it doesnt from analog pin 0-5, if they are suppose to behave as digital too...
this is the code as clean as I could make it:
//I have an array of LED's. All anodes are connected to PIN3 and cathodes are connected to PIN7-19//
int pinArray[] = {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; //an array from pin 7 to 19, stolen from "knight Rider" example
int count = 0;
int timer = 50;
void setup(){
}
void loop() {
PORTD = B00001000; //same as before, pin 3 HIGH and OUTPUT
DDRD = B00001000;
for (count=0;count<13;count++) { //I got this from the "kinght Rider 3 example. a for statement that turns
pinMode(pinArray[count], OUTPUT); // from INPUT to OUTPUT every pin from 7 to 19
delay(timer);
pinMode(pinArray[count], OUTPUT);
delay(timer);
pinMode(pinArray[count], INPUT); // and then turns them INPUT
delay(timer);
}
}