There are a lot of problems with your code.
You say your using A12 to analogue read but it's defined as 1 (A1) in the code.
Ah sorry, I meant A1. So theres not problem.
Your defining the array to store the data within the (for) reading loop and only storing the result to the first cell of the 2089 cell array so you will only ever have one value (in the first cell), the rest will be empty.
int vout = 1;
int clk = 5;
int rog = 11;
int pixel;
int s = 0;
int u = 0;
int sampleArray[2087];
void setup() {
pinMode(vout,INPUT);
pinMode(clk,OUTPUT);
pinMode(rog,OUTPUT);
Serial.begin(9600);
}
void loop() {
//read
Serial.println("\nstart readout\n");
digitalWrite(clk,HIGH);
digitalWrite(rog,HIGH);
delayMicroseconds(1);
digitalWrite(rog,LOW);
delayMicroseconds(1.01);
digitalWrite(rog,HIGH);
delayMicroseconds(5);
for(int i = 0; i < 2087; i++ )
{
digitalWrite(clk,LOW);
delayMicroseconds(1);
digitalWrite(clk,HIGH);
sampleArray[s] = {analogRead(vout)};
s = s++; //counter
delayMicroseconds(1);
}
for(int i = 0; i < 2087; i++ )
{
Serial.println(sampleArray[u]);
u = u++;
delayMicroseconds(1);
}
}
I tried it this way, but it doesn't work either. How do store the data in different places of the array and how do I get it out of the "for" loop to print the results?
I found the only way to get proper data out of the chip was to use a timer to generate the CLK. I also had to speed up the analogue read as by default it is to slow and lastly I read the entire CCD pixels before sending results to PC over serial.
I care about this problem, after the others ones are solved. I come to this later, but thanks.
The CCD looks like it's pin compatible to the ILX511 so why don't you try the code I wrote (here) to see if it works.
Even if it works, I can't explain all the steps and things you wrote in your code, but I have to explain it in my project, so I think the better way is to write an own code, I can explain step by step.