// 6 April 2024
// by Koepel
//
// Problem: The initial value of zero (or as set in diagram.json)
//          is sometimes use instead of the position of the knob.
//          The knob was set with a previous run.
//          It takes always exactly the same time to get the
//          value from the position of the knob.
//
// Only tested with Arduino Uno
// Tested with two potentiometer: problem still occurs
// Tested with slide potentiometer: problem still occurs
// Tested with other code to measure the time with millis: problem is gone
// 
// It happens with a fresh start and with a restart, but less often
// with a restart.
//
// This Wokwi project: https://wokwi.com/projects/394419928243853313
// Issue on Github by Pilot65: https://github.com/wokwi/wokwi-elements/issues/163
//

void setup()
{
  Serial.begin(9600);
  Serial.println("First 10 values");
  
  for(int i=0; i<10; i++)
  {
    int rawValue = analogRead(0);
    Serial.print(i);
    Serial.print(": ");
    Serial.println(rawValue);
    delay(5);
  }
}

void loop()
{
  delay(10);
}