// Arduino Uno clásico ATmega328P. Potenciómetro entre GND y 5V, cursor A0. // No conectar tensiones superiores a Vcc. Vref=5000 mV es una hipótesis nominal. void setup() { Serial.begin(115200); } void loop() { unsigned long total = 0; for (int i=0; i<16; ++i) { total += analogRead(A0); delay(2); } unsigned int raw = (total + 8) / 16; unsigned long mv = (raw * 5000UL + 511UL) / 1023UL; Serial.print(F("{\"ms\":")); Serial.print(millis()); Serial.print(F(",\"raw\":")); Serial.print(raw); Serial.print(F(",\"mv\":")); Serial.print(mv); Serial.println('}'); delay(250); }