const int vPIN = A0; // Analog pin for voltage measurement float vOUT = 0.0; float vIN = 0.0; float R1 = 10000.0; // Resistor 1 value in ohms (e.g., 10K ohms) float R2 = 1000.0; // Resistor 2 value in ohms (e.g., 1K ohms) void setup() { Serial.begin(9600); delay(2000); } void loop() { int sensorValue = analogRead(vPIN); // Read analog value vOUT = (sensorValue * 5.0) / 1024.0; // Convert to voltage vIN = vOUT / (R2 / (R1 + R2)); // Calculate motor voltage Serial.print("Motor Voltage: "); Serial.print(vIN); Serial.println("V"); delay(500); }