My software should behave different when a potentiometer is attached to A5.
My idea was to toggle the pullup-resistor and check what happens.
/*
* is a poti connected to a certain analog input?
*/
const byte inputPin = A5;
const long dt1 = 100;
const long dt2 = 10;
void setup() {
Serial.begin(9600);
Serial.println(__FILE__);
}
boolean b;
long t = millis() + dt1;
void loop() {
if (millis() > t) {
b = !b;
if (b) pinMode(inputPin,INPUT);
else pinMode(inputPin,INPUT_PULLUP);
t = t + dt1;
}
int v = analogRead(inputPin);
//Serial.print("0 1024 ");
Serial.println(v);
delay(dt2);
}
But the results are not easy to process. This is what the Serial Plotter shows:
Anyone having a good idea how to say potentiometer is max or no potentiometer connected?