AP1017 library for the Rev.E hardware with expanded capabilities.
Fork of AP1017 by
Diff: AP1017.cpp
- Revision:
- 12:bebb667c182f
- Parent:
- 11:ac867fa4aa10
diff -r ac867fa4aa10 -r bebb667c182f AP1017.cpp --- a/AP1017.cpp Tue May 01 21:28:57 2018 +0000 +++ b/AP1017.cpp Fri May 04 19:01:41 2018 +0000 @@ -30,37 +30,31 @@ case DIRECTION_CW: // direction = 0x00 if(isMotorOn()) { - MSG("#Error: Cannot change direction while motor is running.\r\n"); return ERROR_MOTORON; }else { inA->write(1); inB->write(0); - MSG("#Direction: CCW\r\n"); } break; case DIRECTION_CCW: // direction = 0x01 if(isMotorOn()) { - MSG("#Error: Cannot change direction while motor is running.\r\n"); return ERROR_MOTORON; }else { inA->write(0); inB->write(1); - MSG("#Direction: CW\r\n"); } break; case DIRECTION_BRAKE: // direction = 0x03 inA->write(1); inB->write(1); - MSG("#Direction: Brake\r\n"); break; case DIRECTION_COAST: // direction = 0x04 inA->write(0); inB->write(0); motorOn = false; - MSG("#Direction: Coast\r\n"); break; default: return ERROR_DIRECTION; @@ -72,23 +66,6 @@ AP1017::Rotation AP1017::getDirection(void) { - MSG("#Direction: "); - switch(direction){ - case DIRECTION_CW: - MSG("CW\r\n"); - break; - case DIRECTION_CCW: - MSG("CCW\r\n"); - break; - case DIRECTION_COAST: - MSG("Coast\r\n"); - break; - case DIRECTION_BRAKE: - MSG("Brake\r\n"); - break; - default: - MSG("Error: Invalid direction\r\n"); - } return direction; } @@ -100,8 +77,7 @@ dutyCycle = dc/100.0; if(motorOn == true){ - MSG("Speed setting not yet implemented.\r\n"); - //MSG("#Changed running motor speed: %.1f%%.\r\n", dc); + return ERROR_MOTORON; } } else @@ -116,7 +92,6 @@ double AP1017::getSpeed(void) { - MSG("Speed: %.1f%%\r\n.", dutyCycle*100.0); return dutyCycle*100.0; } @@ -124,7 +99,7 @@ AP1017::Status AP1017::start(void) { en->write(1); - motorOn = true; // Set ON flag + motorOn = true; // Set ON flag return SUCCESS; }