Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BridgeDriver FrontPanelButtons MCP23017 SDFileSystem TextLCD mbed
Diff: DeviceClasses.h
- Revision:
- 1:5731f31f96be
- Parent:
- 0:22618cf06f45
--- a/DeviceClasses.h Tue Sep 16 15:28:59 2014 +0000
+++ b/DeviceClasses.h Tue Sep 16 18:27:41 2014 +0000
@@ -246,6 +246,12 @@
wait(3);
*/
+ lcd.setAddress(0,2);
+ lcd.printf("wrd1: %s", lineData.word[0]);
+ lcd.setAddress(0,3);
+ lcd.printf("TEST1 ");
+ wait(1);
+
char *firstWord = lineData.word[0]; //splits the str based on a space delimeter
if (strncmp(firstWord,"device", 6) == 0){
@@ -320,6 +326,12 @@
/******************************************************************************/
else if (strncmp(func,"drive", 5) == 0){
+ lcd.setAddress(0,2);
+ lcd.printf("wrd2: %s", lineData.word[1]);
+ lcd.setAddress(0,3);
+ lcd.printf("TEST2 ");
+ wait(1);
+
if (lineData.numWords != 4){
//Error Check, incorrect number of parameter, error out
return 0;
@@ -329,17 +341,29 @@
char *speed = lineData.word[2];
char *dir = lineData.word[3];
+ lcd.setAddress(0,3);
+ lcd.printf("TEST3 ");
+
//Initialize Convertion Variables if needed
float speedValue;
int dirValue = 0;
+ lcd.setAddress(0,3);
+ lcd.printf("TEST4 ");
+
//Convert string to usable values
//NOTE both atof and atoi functions return 0 if no valid conversion could be performed
speedValue = atof(speed) / 100;
+ lcd.setAddress(0,3);
+ lcd.printf("TEST5 ");
+
if (speedValue <= 0)
return 0; //Error Out because a value gives no functionality or is wrong
+ lcd.setAddress(0,3);
+ lcd.printf("TEST6 ");
+
if (strncmp(dir,"CC", 2) == 0 || strncmp(dir,"cc", 2) == 0)
dirValue = -1; //Turn Clockwise
else if (strncmp(dir,"C", 1) == 0 || strncmp(dir,"c", 1) == 0)
@@ -347,13 +371,26 @@
else
return 0; //Error Out since the parameter is incorrect
+ lcd.setAddress(0,3);
+ lcd.printf("TEST7 ");
+
bridges.drive(getMotor(), dirValue, speedValue); //Turn on the Motor
+
+ lcd.setAddress(0,3);
+ lcd.printf("TEST8 ");
+
}
/******************************************************************************/
/**** <Func: off> ****/
/******************************************************************************/
else if (strncmp(func,"off", 3) == 0){
+ lcd.setAddress(0,2);
+ lcd.printf("wrd2: %s", lineData.word[1]);
+ lcd.setAddress(0,3);
+ lcd.printf("TEST2 ");
+ wait(1);
+
if (lineData.numWords != 2){
//Error Check, incorrect number of parameter, error out
return 0;