Which means it might be even better to put it in processInput().
So then you could write loop() very cleanly as
void loop()
{
int now=millis();
if (Serial.available()) // Serial Received "Event"
{
processInput();
last=now; // reset serial timer
}
if ( now - last > interval) // Serial Timer Expired "Event"
{
digitalWrite( M1B, LOW); // turn off motors
}
}
Note that "else" is not actually necessary.
Grabbing now=millis() at the start of the loop is a often handy.
Better variable names might include:
last ==> lastSerialProcessed or serialTimerStarted (or comm instead of serial)
interval ==> serialTimeout or serialTimeOutInterval
Cheers,
John