From 580ed069c96bd855c5ddadc8c5ad88d43dd79eac Mon Sep 17 00:00:00 2001 From: photodude Date: Sat, 18 Apr 2015 10:55:47 -0600 Subject: [PATCH] add stopIfFault from code and put in library functions belong in the library not the code (even if they work in the code) --- .../DualVNH5019MotorShieldMod3.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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); + } +}