int motor_direction = 8; // Motor direction int motor_PWM = 10; // Motor PWM int vpropi = A0; // VPROPI pin float voltage = 0; // VPROPI voltage float current = 0; // Motor current float supply = 9.1; // Measured with Multimeter float consumption = 0; // Power consumption void setup() { pinMode(15,OUTPUT); // Set SysOn PIN as output digitalWrite(15,HIGH); // Set SysOn HIGH to power PCB pinMode(motor_direction, OUTPUT); // Set DirectionMOT as output pinMode(motor_PWM, OUTPUT); // Set PWM_MOT as output analogReference(INTERNAL); Serial.begin(9600); } void loop() { digitalWrite(motor_direction, HIGH); analogWrite(motor_PWM,255); voltage = (float) analogRead(vpropi); current = voltage * 4.881; consumption = supply * current; Serial.print("Current: "); Serial.print(current); Serial.print(" mA | Power: "); Serial.print(consumption); Serial.println(" mW"); delay(100); }