Hello everyone,
I am facing a problem with my code possibly as, I want to overclock my ADCs (for Audio recording)
and store the samples into SRAM or external module. I can not understand with I always keep always getting
the value "1023" whether there is input or not and can not pretty udnerstand this! Should I declare that I want
the analog pins to work as input? and why does it not work? If you do have any questions please let me know.
Thank you in advance,
Napster
int time;
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
void setup() {
int start ;
int i ;
Serial.begin(9600);
#if FASTADC
// set prescale to 2,16,32 etc
cbi(ADCSRA,ADPS2) ;
cbi(ADCSRA,ADPS1) ;
cbi(ADCSRA,ADPS0) ;
#endif
}
void loop() {
time = micros();
int sensorValue = analogRead(A0);
time = micros() - time;
Serial.print("\n");
Serial.println(time);
Serial.print(sensorValue);
delay(100);
}