Here is a simple code I tried but it is producing garbage. For example when I ground PIN A6. it should read 0 but some readings will produce values greater than 0 I do not know why. I am trying to read sensor with 3692 pixels.
int myArray[3692];
void setup()
{
Serial.begin(9600);
REG_ADC_MR = 0x10380180; // FREERUN
ADC -> ADC_CHER = 0x02; // enable ADC on pin A6, AD1
delay(1);
}
void loop()
{
for (int i = 0; i < 3692; i++) {
while ((ADC->ADC_ISR & 0x02) == 0); // wait for conversion
myArray = ADC->ADC_CDR[1]; // read value A6, AD1
- }*
for (int i = 0; i < 3692; i++){
_ Serial.println(myArray*);_
_ }_
_}*_