Mitchell Hatfield / Mbed 2 deprecated Component_Test_Interface

Dependencies:   BridgeDriver FrontPanelButtons MCP23017 SDFileSystem TextLCD mbed

Committer:
mehatfie
Date:
Tue Sep 16 15:28:59 2014 +0000
Revision:
0:22618cf06f45
Child:
1:5731f31f96be
- Initial Commit; - Code is a mess (in mid transition of general code architecture); - Functionality work to drive motors in both direction and turn off; - Delay functionality working; - Able to read a program from a txt file and perform functionality

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mehatfie 0:22618cf06f45 1 /*#include "mbed.h"
mehatfie 0:22618cf06f45 2 #include "LocalPinNames.h"
mehatfie 0:22618cf06f45 3 #include "TextLCD.h"
mehatfie 0:22618cf06f45 4 #include "BridgeDriver.h"
mehatfie 0:22618cf06f45 5 */
mehatfie 0:22618cf06f45 6 #include "Device.hpp"
mehatfie 0:22618cf06f45 7
mehatfie 0:22618cf06f45 8
mehatfie 0:22618cf06f45 9 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 10 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 11 /*************************** <CLASS: Voltage_Driver> ****************************/
mehatfie 0:22618cf06f45 12 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 13 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 14
mehatfie 0:22618cf06f45 15 class Voltage_Driver{
mehatfie 0:22618cf06f45 16
mehatfie 0:22618cf06f45 17 public :
mehatfie 0:22618cf06f45 18 //uint8_t ch123; //Channel value this device is set to
mehatfie 0:22618cf06f45 19 int ch;
mehatfie 0:22618cf06f45 20 int test;
mehatfie 0:22618cf06f45 21
mehatfie 0:22618cf06f45 22 int interpret();
mehatfie 0:22618cf06f45 23 int forceBrake();
mehatfie 0:22618cf06f45 24 //int forceFloat();
mehatfie 0:22618cf06f45 25 float drive();
mehatfie 0:22618cf06f45 26
mehatfie 0:22618cf06f45 27 //Voltage_Driver();
mehatfie 0:22618cf06f45 28 void setChannel(int channel){
mehatfie 0:22618cf06f45 29 Voltage_Driver::ch = channel;
mehatfie 0:22618cf06f45 30 }
mehatfie 0:22618cf06f45 31
mehatfie 0:22618cf06f45 32 int getChannel(){
mehatfie 0:22618cf06f45 33 return Voltage_Driver::ch;
mehatfie 0:22618cf06f45 34 }
mehatfie 0:22618cf06f45 35 };
mehatfie 0:22618cf06f45 36
mehatfie 0:22618cf06f45 37 //Voltage_Driver::Voltage_Driver(void){
mehatfie 0:22618cf06f45 38 //}
mehatfie 0:22618cf06f45 39
mehatfie 0:22618cf06f45 40 //A line consists of [ __(Local_Name)__ __(function)__ __(parameter1)__ __(parameter2)__ __(parameter3)__ ... and so on]
mehatfie 0:22618cf06f45 41 int Voltage_Driver::interpret(){
mehatfie 0:22618cf06f45 42 /*
mehatfie 0:22618cf06f45 43 lcd.cls(); //clear the display
mehatfie 0:22618cf06f45 44 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 45 lcd.printf("Test2 ");
mehatfie 0:22618cf06f45 46 lcd.setAddress(0,1);
mehatfie 0:22618cf06f45 47 lcd.printf("wrd1: %s", lineData.word[0]);
mehatfie 0:22618cf06f45 48 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 49 lcd.printf("wrd2: %s", lineData.word[1]);
mehatfie 0:22618cf06f45 50 wait(3);
mehatfie 0:22618cf06f45 51 */
mehatfie 0:22618cf06f45 52
mehatfie 0:22618cf06f45 53
mehatfie 0:22618cf06f45 54 char *firstWord = lineData.word[0]; //get the first word in the line
mehatfie 0:22618cf06f45 55 /*
mehatfie 0:22618cf06f45 56 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 57 lcd.printf("fW: %s", firstWord);
mehatfie 0:22618cf06f45 58 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 59 lcd.printf("ch: %d", ch);
mehatfie 0:22618cf06f45 60 wait(3);*/
mehatfie 0:22618cf06f45 61
mehatfie 0:22618cf06f45 62 //Initialize the class and device
mehatfie 0:22618cf06f45 63 if (strncmp(firstWord,"device", 6) == 0){
mehatfie 0:22618cf06f45 64 //Order of Line: Command, Local_Name, VOLTAGE_DRIVER, Channel(1,2,3,4,5,6,7,8)
mehatfie 0:22618cf06f45 65
mehatfie 0:22618cf06f45 66 test = 10;
mehatfie 0:22618cf06f45 67
mehatfie 0:22618cf06f45 68 if (lineData.numWords != 4){
mehatfie 0:22618cf06f45 69 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 70 return 0;
mehatfie 0:22618cf06f45 71 }
mehatfie 0:22618cf06f45 72
mehatfie 0:22618cf06f45 73 char *channel = lineData.word[3]; //Parameter is a number
mehatfie 0:22618cf06f45 74 int channelValue = atoi(channel);
mehatfie 0:22618cf06f45 75
mehatfie 0:22618cf06f45 76 //Channel Value between 1 to 8
mehatfie 0:22618cf06f45 77 if (channelValue >= 1 && channelValue <= 8){
mehatfie 0:22618cf06f45 78
mehatfie 0:22618cf06f45 79 setChannel(channelValue);
mehatfie 0:22618cf06f45 80 //ch = channelValue;
mehatfie 0:22618cf06f45 81
mehatfie 0:22618cf06f45 82 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 83 lcd.printf("fW: %s", firstWord);
mehatfie 0:22618cf06f45 84 //lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 85 //lcd.printf("ch: %d", getChannel());
mehatfie 0:22618cf06f45 86 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 87 lcd.printf("test: %d", test);
mehatfie 0:22618cf06f45 88 //lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 89 //lcd.printf("chString: %s", chString);
mehatfie 0:22618cf06f45 90 wait(2);
mehatfie 0:22618cf06f45 91
mehatfie 0:22618cf06f45 92 switch (channelValue){
mehatfie 0:22618cf06f45 93 case 1:
mehatfie 0:22618cf06f45 94 case 2:
mehatfie 0:22618cf06f45 95 bridges.enablePwm(BridgeDriver::MOTOR_A, 0);
mehatfie 0:22618cf06f45 96 break;
mehatfie 0:22618cf06f45 97 case 3:
mehatfie 0:22618cf06f45 98 case 4:
mehatfie 0:22618cf06f45 99 bridges.enablePwm(BridgeDriver::MOTOR_B, 0);
mehatfie 0:22618cf06f45 100 break;
mehatfie 0:22618cf06f45 101 case 5:
mehatfie 0:22618cf06f45 102 case 6:
mehatfie 0:22618cf06f45 103 bridges.enablePwm(BridgeDriver::MOTOR_C, 0);
mehatfie 0:22618cf06f45 104 break;
mehatfie 0:22618cf06f45 105 case 7:
mehatfie 0:22618cf06f45 106 case 8:
mehatfie 0:22618cf06f45 107 bridges.enablePwm(BridgeDriver::MOTOR_D, 0);
mehatfie 0:22618cf06f45 108 break;
mehatfie 0:22618cf06f45 109 }
mehatfie 0:22618cf06f45 110 /* lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 111 lcd.printf("AchannelVal: %d", channelValue);
mehatfie 0:22618cf06f45 112 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 113 lcd.printf("Ach: %d", ch);
mehatfie 0:22618cf06f45 114 wait(3);*/
mehatfie 0:22618cf06f45 115
mehatfie 0:22618cf06f45 116 }
mehatfie 0:22618cf06f45 117 else{
mehatfie 0:22618cf06f45 118 //ERROR Out
mehatfie 0:22618cf06f45 119 //Unacceptable channel, or conversion function failed when converting string to int
mehatfie 0:22618cf06f45 120 }
mehatfie 0:22618cf06f45 121 }
mehatfie 0:22618cf06f45 122
mehatfie 0:22618cf06f45 123 //if the first word is not "device" it means that it's trying to perform a function to a specific Motor
mehatfie 0:22618cf06f45 124 else{
mehatfie 0:22618cf06f45 125
mehatfie 0:22618cf06f45 126
mehatfie 0:22618cf06f45 127
mehatfie 0:22618cf06f45 128 //Order of Line: Local_Name, Function_Name, Param1, Param2, Param3,.......
mehatfie 0:22618cf06f45 129 char *localname = lineData.word[0]; //just for the sake of following the variable easily and understanding
mehatfie 0:22618cf06f45 130 char *func = lineData.word[1];
mehatfie 0:22618cf06f45 131
mehatfie 0:22618cf06f45 132 /******************************************************************************/
mehatfie 0:22618cf06f45 133 /*** <Func: forceBrake> ***/
mehatfie 0:22618cf06f45 134 /******************************************************************************/
mehatfie 0:22618cf06f45 135 if (strncmp(func,"forceBrake", 10) == 0){
mehatfie 0:22618cf06f45 136
mehatfie 0:22618cf06f45 137 if (lineData.numWords != 3){
mehatfie 0:22618cf06f45 138 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 139 return 0;
mehatfie 0:22618cf06f45 140 }
mehatfie 0:22618cf06f45 141
mehatfie 0:22618cf06f45 142 bridges.forceBrake(ch);
mehatfie 0:22618cf06f45 143 }
mehatfie 0:22618cf06f45 144
mehatfie 0:22618cf06f45 145
mehatfie 0:22618cf06f45 146 /******************************************************************************/
mehatfie 0:22618cf06f45 147 /*** <Func: drive> ***/
mehatfie 0:22618cf06f45 148 /******************************************************************************/
mehatfie 0:22618cf06f45 149 else if (strncmp(func,"drive", 5) == 0){
mehatfie 0:22618cf06f45 150 //Order of Line: Local_Name, drive
mehatfie 0:22618cf06f45 151
mehatfie 0:22618cf06f45 152 lcd.setAddress(0,0);
mehatfie 0:22618cf06f45 153 lcd.printf("lclN: %s ", localname);
mehatfie 0:22618cf06f45 154 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 155 lcd.printf("func: %s ", func);
mehatfie 0:22618cf06f45 156 //lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 157 //lcd.printf("3ch: %d ", getChannel());
mehatfie 0:22618cf06f45 158 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 159 lcd.printf("test: %d", test);
mehatfie 0:22618cf06f45 160 //lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 161 //lcd.printf("chString: %s ", chString);
mehatfie 0:22618cf06f45 162 wait(3);
mehatfie 0:22618cf06f45 163
mehatfie 0:22618cf06f45 164 if (lineData.numWords != 2){
mehatfie 0:22618cf06f45 165 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 166 return 0;
mehatfie 0:22618cf06f45 167 }
mehatfie 0:22618cf06f45 168 /*
mehatfie 0:22618cf06f45 169 int State = 2;
mehatfie 0:22618cf06f45 170 int channelValue = atoi(chString);
mehatfie 0:22618cf06f45 171 State = bridges.drive(channelValue, 1); //Turn channel on
mehatfie 0:22618cf06f45 172 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 173 lcd.printf("TEST ch: %d, State: %d", channelValue, State);
mehatfie 0:22618cf06f45 174 wait(3);*/
mehatfie 0:22618cf06f45 175
mehatfie 0:22618cf06f45 176 }
mehatfie 0:22618cf06f45 177
mehatfie 0:22618cf06f45 178
mehatfie 0:22618cf06f45 179 /******************************************************************************/
mehatfie 0:22618cf06f45 180 /**** <Func: off> ****/
mehatfie 0:22618cf06f45 181 /******************************************************************************/
mehatfie 0:22618cf06f45 182 else if (strncmp(func,"drive", 5) == 0){
mehatfie 0:22618cf06f45 183 //Order of Line: Local_Name, drive, duration
mehatfie 0:22618cf06f45 184
mehatfie 0:22618cf06f45 185 if (lineData.numWords != 2){
mehatfie 0:22618cf06f45 186 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 187 return 0;
mehatfie 0:22618cf06f45 188 }
mehatfie 0:22618cf06f45 189
mehatfie 0:22618cf06f45 190 bridges.drive(getChannel(), 0); //Turn channel off
mehatfie 0:22618cf06f45 191 }
mehatfie 0:22618cf06f45 192
mehatfie 0:22618cf06f45 193 else {
mehatfie 0:22618cf06f45 194 return 0;
mehatfie 0:22618cf06f45 195
mehatfie 0:22618cf06f45 196 }
mehatfie 0:22618cf06f45 197 }
mehatfie 0:22618cf06f45 198 /*
mehatfie 0:22618cf06f45 199 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 200 lcd.printf("ENDch: %d ", getChannel());
mehatfie 0:22618cf06f45 201 wait(3);*/
mehatfie 0:22618cf06f45 202
mehatfie 0:22618cf06f45 203 return 1;
mehatfie 0:22618cf06f45 204 }
mehatfie 0:22618cf06f45 205
mehatfie 0:22618cf06f45 206
mehatfie 0:22618cf06f45 207
mehatfie 0:22618cf06f45 208 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 209 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 210 /******************************** <CLASS: Motor> ********************************/
mehatfie 0:22618cf06f45 211 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 212 /**********************************************************************************************************************************/
mehatfie 0:22618cf06f45 213
mehatfie 0:22618cf06f45 214 class Motor{
mehatfie 0:22618cf06f45 215
mehatfie 0:22618cf06f45 216 enum BridgeDriver::Motors motor;
mehatfie 0:22618cf06f45 217
mehatfie 0:22618cf06f45 218 public :
mehatfie 0:22618cf06f45 219 int interpret();
mehatfie 0:22618cf06f45 220 void enableBrake();
mehatfie 0:22618cf06f45 221 int forceBrake();
mehatfie 0:22618cf06f45 222 //int forceFloat();
mehatfie 0:22618cf06f45 223 float drive();
mehatfie 0:22618cf06f45 224
mehatfie 0:22618cf06f45 225
mehatfie 0:22618cf06f45 226 void setMotor(BridgeDriver::Motors selectedMotor){
mehatfie 0:22618cf06f45 227 motor = selectedMotor;
mehatfie 0:22618cf06f45 228 }
mehatfie 0:22618cf06f45 229
mehatfie 0:22618cf06f45 230 enum BridgeDriver::Motors getMotor(){
mehatfie 0:22618cf06f45 231 return motor;
mehatfie 0:22618cf06f45 232 }
mehatfie 0:22618cf06f45 233
mehatfie 0:22618cf06f45 234 };
mehatfie 0:22618cf06f45 235
mehatfie 0:22618cf06f45 236 //A line consists of [ __(Local_Name)__ __(function)__ __(parameter1)__ __(parameter2)__ __(parameter3)__ ... and so on]
mehatfie 0:22618cf06f45 237 int Motor::interpret(){
mehatfie 0:22618cf06f45 238 /*
mehatfie 0:22618cf06f45 239 lcd.cls(); //clear the display
mehatfie 0:22618cf06f45 240 lcd.setAddress(0,3);
mehatfie 0:22618cf06f45 241 lcd.printf("Test2 ");
mehatfie 0:22618cf06f45 242 lcd.setAddress(0,1);
mehatfie 0:22618cf06f45 243 lcd.printf("wrd1: %s", lineData.word[0]);
mehatfie 0:22618cf06f45 244 lcd.setAddress(0,2);
mehatfie 0:22618cf06f45 245 lcd.printf("wrd2: %s", lineData.word[1]);
mehatfie 0:22618cf06f45 246 wait(3);
mehatfie 0:22618cf06f45 247 */
mehatfie 0:22618cf06f45 248
mehatfie 0:22618cf06f45 249 char *firstWord = lineData.word[0]; //splits the str based on a space delimeter
mehatfie 0:22618cf06f45 250
mehatfie 0:22618cf06f45 251 if (strncmp(firstWord,"device", 6) == 0){
mehatfie 0:22618cf06f45 252 //Order of Line: Command, Local_Name, VOLTAGE_DRIVER, Channel(1,2,3,4,5,6,7,8)
mehatfie 0:22618cf06f45 253
mehatfie 0:22618cf06f45 254 if (lineData.numWords != 4){
mehatfie 0:22618cf06f45 255 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 256 return 0;
mehatfie 0:22618cf06f45 257 }
mehatfie 0:22618cf06f45 258
mehatfie 0:22618cf06f45 259 char channel = *lineData.word[3]; //Parameter is a single character, so dereference the point to the word
mehatfie 0:22618cf06f45 260
mehatfie 0:22618cf06f45 261 switch (channel){
mehatfie 0:22618cf06f45 262 case 'A':
mehatfie 0:22618cf06f45 263 case 'a':
mehatfie 0:22618cf06f45 264 setMotor(BridgeDriver::MOTOR_A);
mehatfie 0:22618cf06f45 265 break;
mehatfie 0:22618cf06f45 266 case 'B':
mehatfie 0:22618cf06f45 267 case 'b':
mehatfie 0:22618cf06f45 268 setMotor(BridgeDriver::MOTOR_B);
mehatfie 0:22618cf06f45 269 break;
mehatfie 0:22618cf06f45 270 case 'C':
mehatfie 0:22618cf06f45 271 case 'c':
mehatfie 0:22618cf06f45 272 setMotor(BridgeDriver::MOTOR_C);
mehatfie 0:22618cf06f45 273 break;
mehatfie 0:22618cf06f45 274 case 'D':
mehatfie 0:22618cf06f45 275 case 'd':
mehatfie 0:22618cf06f45 276 setMotor(BridgeDriver::MOTOR_D);
mehatfie 0:22618cf06f45 277 break;
mehatfie 0:22618cf06f45 278 }
mehatfie 0:22618cf06f45 279 }
mehatfie 0:22618cf06f45 280
mehatfie 0:22618cf06f45 281 //if the first word is not "device" it means that it's trying to perform a function to a specific Motor
mehatfie 0:22618cf06f45 282 else{
mehatfie 0:22618cf06f45 283 //Order of Line: Local_Name, Function_Name, Param1, Param2, Param3,.......
mehatfie 0:22618cf06f45 284 char *localname = lineData.word[0]; //just for the sake of following the variable easily and understanding
mehatfie 0:22618cf06f45 285 char *func = lineData.word[1];
mehatfie 0:22618cf06f45 286
mehatfie 0:22618cf06f45 287 /******************************************************************************/
mehatfie 0:22618cf06f45 288 /*** <Func: enableBrake> ***/
mehatfie 0:22618cf06f45 289 /******************************************************************************/
mehatfie 0:22618cf06f45 290 if (strncmp(func,"enableBrake", 11) == 0){
mehatfie 0:22618cf06f45 291
mehatfie 0:22618cf06f45 292 if (lineData.numWords != 4){
mehatfie 0:22618cf06f45 293 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 294 return 0;
mehatfie 0:22618cf06f45 295 }
mehatfie 0:22618cf06f45 296
mehatfie 0:22618cf06f45 297 //Initialize and Convert Parameters
mehatfie 0:22618cf06f45 298 char *enable = lineData.word[2];
mehatfie 0:22618cf06f45 299 int enableValue = atoi(enable);
mehatfie 0:22618cf06f45 300
mehatfie 0:22618cf06f45 301 bridges.enableBraking(getMotor(), enableValue);
mehatfie 0:22618cf06f45 302 }
mehatfie 0:22618cf06f45 303
mehatfie 0:22618cf06f45 304 /******************************************************************************/
mehatfie 0:22618cf06f45 305 /*** <Func: forceBrake> ***/
mehatfie 0:22618cf06f45 306 /******************************************************************************/
mehatfie 0:22618cf06f45 307 else if (strncmp(func,"forceBrake", 10) == 0){
mehatfie 0:22618cf06f45 308
mehatfie 0:22618cf06f45 309 if (lineData.numWords != 3){
mehatfie 0:22618cf06f45 310 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 311 return 0;
mehatfie 0:22618cf06f45 312 }
mehatfie 0:22618cf06f45 313
mehatfie 0:22618cf06f45 314 bridges.forceBrake(getMotor());
mehatfie 0:22618cf06f45 315 }
mehatfie 0:22618cf06f45 316
mehatfie 0:22618cf06f45 317
mehatfie 0:22618cf06f45 318 /******************************************************************************/
mehatfie 0:22618cf06f45 319 /*** <Func: drive> ***/
mehatfie 0:22618cf06f45 320 /******************************************************************************/
mehatfie 0:22618cf06f45 321 else if (strncmp(func,"drive", 5) == 0){
mehatfie 0:22618cf06f45 322
mehatfie 0:22618cf06f45 323 if (lineData.numWords != 4){
mehatfie 0:22618cf06f45 324 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 325 return 0;
mehatfie 0:22618cf06f45 326 }
mehatfie 0:22618cf06f45 327
mehatfie 0:22618cf06f45 328 //Initialize Parameters
mehatfie 0:22618cf06f45 329 char *speed = lineData.word[2];
mehatfie 0:22618cf06f45 330 char *dir = lineData.word[3];
mehatfie 0:22618cf06f45 331
mehatfie 0:22618cf06f45 332 //Initialize Convertion Variables if needed
mehatfie 0:22618cf06f45 333 float speedValue;
mehatfie 0:22618cf06f45 334 int dirValue = 0;
mehatfie 0:22618cf06f45 335
mehatfie 0:22618cf06f45 336 //Convert string to usable values
mehatfie 0:22618cf06f45 337 //NOTE both atof and atoi functions return 0 if no valid conversion could be performed
mehatfie 0:22618cf06f45 338 speedValue = atof(speed) / 100;
mehatfie 0:22618cf06f45 339
mehatfie 0:22618cf06f45 340 if (speedValue <= 0)
mehatfie 0:22618cf06f45 341 return 0; //Error Out because a value gives no functionality or is wrong
mehatfie 0:22618cf06f45 342
mehatfie 0:22618cf06f45 343 if (strncmp(dir,"CC", 2) == 0 || strncmp(dir,"cc", 2) == 0)
mehatfie 0:22618cf06f45 344 dirValue = -1; //Turn Clockwise
mehatfie 0:22618cf06f45 345 else if (strncmp(dir,"C", 1) == 0 || strncmp(dir,"c", 1) == 0)
mehatfie 0:22618cf06f45 346 dirValue = 1; //Turn CounterClockwise
mehatfie 0:22618cf06f45 347 else
mehatfie 0:22618cf06f45 348 return 0; //Error Out since the parameter is incorrect
mehatfie 0:22618cf06f45 349
mehatfie 0:22618cf06f45 350 bridges.drive(getMotor(), dirValue, speedValue); //Turn on the Motor
mehatfie 0:22618cf06f45 351 }
mehatfie 0:22618cf06f45 352 /******************************************************************************/
mehatfie 0:22618cf06f45 353 /**** <Func: off> ****/
mehatfie 0:22618cf06f45 354 /******************************************************************************/
mehatfie 0:22618cf06f45 355 else if (strncmp(func,"off", 3) == 0){
mehatfie 0:22618cf06f45 356
mehatfie 0:22618cf06f45 357 if (lineData.numWords != 2){
mehatfie 0:22618cf06f45 358 //Error Check, incorrect number of parameter, error out
mehatfie 0:22618cf06f45 359 return 0;
mehatfie 0:22618cf06f45 360 }
mehatfie 0:22618cf06f45 361
mehatfie 0:22618cf06f45 362 bridges.drive(getMotor(), 0, 0); //Turn off the Motor
mehatfie 0:22618cf06f45 363 }
mehatfie 0:22618cf06f45 364
mehatfie 0:22618cf06f45 365 else {
mehatfie 0:22618cf06f45 366 return 0;
mehatfie 0:22618cf06f45 367
mehatfie 0:22618cf06f45 368 }
mehatfie 0:22618cf06f45 369 }
mehatfie 0:22618cf06f45 370
mehatfie 0:22618cf06f45 371 return 1;
mehatfie 0:22618cf06f45 372 }
mehatfie 0:22618cf06f45 373
mehatfie 0:22618cf06f45 374
mehatfie 0:22618cf06f45 375
mehatfie 0:22618cf06f45 376
mehatfie 0:22618cf06f45 377
mehatfie 0:22618cf06f45 378
mehatfie 0:22618cf06f45 379
mehatfie 0:22618cf06f45 380
mehatfie 0:22618cf06f45 381
mehatfie 0:22618cf06f45 382
mehatfie 0:22618cf06f45 383
mehatfie 0:22618cf06f45 384
mehatfie 0:22618cf06f45 385
mehatfie 0:22618cf06f45 386
mehatfie 0:22618cf06f45 387
mehatfie 0:22618cf06f45 388
mehatfie 0:22618cf06f45 389
mehatfie 0:22618cf06f45 390
mehatfie 0:22618cf06f45 391
mehatfie 0:22618cf06f45 392
mehatfie 0:22618cf06f45 393
mehatfie 0:22618cf06f45 394