outputMsg("Main Brush Motor Current: "+String(mCurrent),MSG_DEBUG_ONLY);
outputMsg("Side Brush Motor Current: "+String(sCurrent),MSG_DEBUG_ONLY);
if(stat==STAT_STOP)
{
if(mCurrent>MOTOR_CURRENT_TH)// main brush motor works
{
stat=STAT_CLEAN;
time_start=millis();
traveled_mm=0;
outputMsg("I've started to clean. (Battery: "+String(batteryVoltage)+"mV, Temp: "+String(temp)+"degC) by #Roomba",MSG_ALL);
digitalWrite(PIO_LED,HIGH);
}
}
elseif(stat==STAT_CLEAN)
{
if(mCurrent==0)// main brush motor works stops
{
stat=STAT_STOP;
floattime_elapsed=(millis()-time_start)/60000.0;//convert to minute
floattraveled=traveled_mm/1000.0;// convert to m
outputMsg("I finished cleaning in "+String(time_elapsed)+"minutes. The distance traveled is "+String(traveled)+"m. (Battery: "+String(batteryVoltage)+"mV, Temp: "+String(temp)+"degC) by #Roomba",MSG_ALL);