I cannot get correct values from the Analog Inputs of the Nano Every.
- Voltage on A0: 0.120 Volt (controlled with a Multimeter)
- analogReference(INTERNAL2V5) or analogReference(INTERNAL0V55)
- Read with analogRead(A0): always 1023
Same result from pin A1. What can be wrong?
My sketch:
/*==========================================================================
Test of AnalogIn(Ax) for Nano Every with different reference voltages
--------------------------------------------------------------------------
Autor: Rudolf Schenke
Stand: 05.11.2019: Created
==========================================================================*/
#define anaPin A0 // Pin name for analog channel
#define anaPinText "A0" // Pin name for print
int loopCounter; // Count loop() executes
char prBuffer[32]; // Print buffer
void setup() {
Serial.begin (38400);
while(!Serial) delay(10);
Serial.print("Read AnalogIn ");
Serial.println(anaPinText);
#ifdef ARDUINO_AVR_NANO_EVERY
analogReference(INTERNAL2V5); // Use one of the references
#else
Serial.println("Warning: For Nano Every only - stoped!");
While(true) delay(10);
#endif
Serial.println("List of Analogreferences:");
Serial.print(" DEFAULT\t"); Serial.println(DEFAULT);
Serial.print(" INTERNAL0V55\t"); Serial.println(INTERNAL0V55);
Serial.print(" INTERNAL1V1\t"); Serial.println(INTERNAL1V1);
Serial.print(" INTERNAL2V5\t"); Serial.println(INTERNAL2V5);
Serial.print(" INTERNAL4V3\t"); Serial.println(INTERNAL4V3);
Serial.print(" INTERNAL1V5\t"); Serial.println(INTERNAL1V5);
}
void loop() {
int rawValue = analogRead(anaPin);
sprintf(prBuffer,"Loop %3d Value %4d",++loopCounter, rawValue);
Serial.println(prBuffer);
delay(1000); // Pause.
}