i wrote a code to convert an analog signal to digital on Due. the results ,i am getting on the oscilloscope, of the ADC as shown in Frequency_5Hz (attached) for analog square wave = 1v at the pin( A1). fre = 5Hz.
and by increasing the frequency to 50Hz at scope Frequency_50Hz, the ADC seems like it can't catch up with the input signal.
the code i wrote is:
const int InputPin = A1;
const int OutPin = 28;
void setup()
{
pinMode(InputPin,INPUT);
pinMode(OutPin,OUTPUT);
analogReadResolution(12); // 12-bit!
Serial. begin(9600);
}
void loop() {
int a;
analogReadResolution(12); // 12-bit!
a = analogRead(InputPin);
digitalWrite(OutPin,a);
Serial.println(a);
while(0){
}
}
a confusing point is that in Frequency_5Hz i can see that ADC is responding but not correctly. i think that i should see a series of binaries not a plus looks similar to the input signal.
could anyone tell me why i am getting this
Best Wishes,
M,