diff --git a/DualVNH5019MotorShieldMod3/DualVNH5019MotorShieldMod3.cpp b/DualVNH5019MotorShieldMod3/DualVNH5019MotorShieldMod3.cpp index d2b79a5..6942290 100644 --- a/DualVNH5019MotorShieldMod3/DualVNH5019MotorShieldMod3.cpp +++ b/DualVNH5019MotorShieldMod3/DualVNH5019MotorShieldMod3.cpp @@ -403,3 +403,28 @@ unsigned char DualVNH5019MotorShieldMod3::getM4Fault() { return !digitalRead(_EN4DIAG4); } + +//stop if fault methods +void stopIfFault() +{ + if (md.getM1Fault()) + { + Serial.println("M1 fault"); + while(1); + } + if (md.getM2Fault()) + { + Serial.println("M2 fault"); + while(1); + } + if (md.getM3Fault()) + { + Serial.println("M3 fault"); + while(1); + } + if (md.getM4Fault()) + { + Serial.println("M4 fault"); + while(1); + } +}