ArduinoArduino Uno R4 MinimaLab virtual

Uno R4: 14-bit knob

The Uno R4 Minima reads the knob at 14 bits and dims an LED on D9 with it.

Uno R4: 14-bit knob in Argynix Lab

The code

sketch.inoC++
// Arduino Uno R4 Minima: its ADC reads up to 14 bits. The knob on A0 is read at 14 bits
// (0 to 16383 over 5 V) and dims the LED on D9. The R4's pins give 8 mA each (the classic
// Uno's give 20), so the LED has 470 Ω, not 220.
void setup() {
  Serial.begin(115200);
  analogReadResolution(14);
  pinMode(9, OUTPUT);
}

void loop() {
  int raw = analogRead(A0);
  analogWrite(9, raw >> 6);  // 0..255
  Serial.print("A0: ");
  Serial.print(raw);
  Serial.print(" of 16383, ");
  Serial.print(raw * 5.0 / 16383, 2);
  Serial.println(" V");
  delay(200);
}