read reference voltage ATTiny202 #862
-
The following reads the 0.55V internal voltage reference correctly. However if analogReference(INTERNAL2V5) is called to set the 2.5V reference, the reading is 1023. How can the other voltage references be read while using Vdd as the reference? int x; void loop() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Just found a way by using init_ADC0() int x; void loop() |
Beta Was this translation helpful? Give feedback.
Just found a way by using init_ADC0()
int x;
void setup(){
pinMode(P2,OUTPUT);
analogReference(INTERNAL2V5);
Serial.begin(9600);
while(!Serial) ;;;
init_ADC0(); // this makes it work
}
void loop()
{
Serial.print("Reference: ");
x =analogRead(ADC_INTREF);
Serial.println(x );
delay(1000);
}