When I tested the following code on my Arduino Uno R4 Minima,
I cannot get 0 and 1023.
Arduino Uno R4 WiFi also showed the same thing.
When I ran the code on my Arduino Uno R3, I can get 0 and 1023,
that means no problem with my variable registor and wires.
Did I miss something?
int pin_vr = A1;
void setup() {
pinMode(pin_vr, INPUT);
Serial.begin(9600);
while (!Serial) ;
}
void loop() {
int value = analogRead(pin_vr);
Serial.println(String(value));
delay(100);
}
This is the resulting plot.
Minimum value is about 20, and maximum value is about 900.
Thank you for your valuable comment.
I added 0.1uF capacitor from A1 to ground and I can get 0 and 1023.
Still there is a little bit fluctuation but much better than before.
When I tested some other Arduino boards with SAMD21 microcontroller
there was no problem like this.
This is the difference between SAMD21 and RA4M1 ?
I will dig out RA4M1 datasheet.
Any clues regarding the analog input characteristics of the RA4M1 would be welcome.
This is the resulting plot when I put 0.1uF capacitor.