void setup(){
Serial.begin(9600);
}
void loop() {
//REFS1 AND REFS0 to 1 1 -> internal 1.1V refference
ADMUX |= B11000000;
//We read A1 (MUX0)
ADMUX |= B00000001;
//int sensor = analogRead(A1);
// Start AD conversion
ADCSRA |= B11000000;
// Detect end-of-conversion
while (bit_is_set(ADCSRA,ADSC));
float val = ADCL | (ADCH << 8);
val = val * 5.7; //Multiply by the inverse of the divider
Serial.println(val);
float voltage = val * analogRead(A0) / 1023;
voltage = ADCL | (ADCH << 8);
Serial.print ("voltage at A0:");