Skip to content

read reference voltage ATTiny202 #862

Answered by jazzjohn27
jazzjohn27 asked this question in Q&A
Discussion options

You must be logged in to vote

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);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SpenceKonde
Comment options

@SpenceKonde
Comment options

Answer selected by jazzjohn27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants