Utilities classes for the Zumo Robot

Dependents:   ZumoRobotBluetoothControlled Fsl_Zumo

This library represents some useful code for controlling your Zumo Robot.

Committer:
catalincraciun7
Date:
Thu Nov 13 15:42:46 2014 +0000
Revision:
3:b1fde0759c94
Parent:
2:036da44b023e
Child:
4:dcd52a961392
Minor fixes and documentation added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
catalincraciun7 0:8ebbd2bd34f5 1 // Craciun Catalin
catalincraciun7 0:8ebbd2bd34f5 2 // ZumoRobotManager.cpp
catalincraciun7 0:8ebbd2bd34f5 3 // © 2014 Catalin Craciun
catalincraciun7 0:8ebbd2bd34f5 4
catalincraciun7 0:8ebbd2bd34f5 5 #ifndef ZumoRobotManagerCpp
catalincraciun7 0:8ebbd2bd34f5 6 #define ZumoRobotManagerCpp
catalincraciun7 0:8ebbd2bd34f5 7
catalincraciun7 0:8ebbd2bd34f5 8 #include "ZumoRobotManager.h"
catalincraciun7 2:036da44b023e 9 #include "mbed.h"
catalincraciun7 2:036da44b023e 10
catalincraciun7 3:b1fde0759c94 11 Serial console(USBTX, USBRX);
catalincraciun7 0:8ebbd2bd34f5 12
catalincraciun7 0:8ebbd2bd34f5 13 ZumoRobotManager::ZumoRobotManager() {
catalincraciun7 0:8ebbd2bd34f5 14
catalincraciun7 0:8ebbd2bd34f5 15 // Initialising
catalincraciun7 2:036da44b023e 16 this -> velocityX = 0;
catalincraciun7 2:036da44b023e 17 this -> velocityY = 0;
catalincraciun7 0:8ebbd2bd34f5 18 }
catalincraciun7 0:8ebbd2bd34f5 19
catalincraciun7 0:8ebbd2bd34f5 20 ZumoRobotManager::~ZumoRobotManager() {
catalincraciun7 0:8ebbd2bd34f5 21
catalincraciun7 0:8ebbd2bd34f5 22 // Deinitialising
catalincraciun7 0:8ebbd2bd34f5 23
catalincraciun7 0:8ebbd2bd34f5 24 }
catalincraciun7 0:8ebbd2bd34f5 25
catalincraciun7 2:036da44b023e 26 float ZumoRobotManager::getVelocityX() {
catalincraciun7 2:036da44b023e 27
catalincraciun7 2:036da44b023e 28 return this -> velocityX;
catalincraciun7 2:036da44b023e 29 }
catalincraciun7 2:036da44b023e 30
catalincraciun7 2:036da44b023e 31 float ZumoRobotManager::getVelocityY() {
catalincraciun7 2:036da44b023e 32
catalincraciun7 2:036da44b023e 33 return this -> velocityY;
catalincraciun7 2:036da44b023e 34 }
catalincraciun7 2:036da44b023e 35
catalincraciun7 2:036da44b023e 36 void ZumoRobotManager::setVelocityX(float newValue) {
catalincraciun7 2:036da44b023e 37
catalincraciun7 2:036da44b023e 38 this -> velocityX = newValue;
catalincraciun7 2:036da44b023e 39 }
catalincraciun7 2:036da44b023e 40
catalincraciun7 2:036da44b023e 41 void ZumoRobotManager::setVelocityY(float newValue) {
catalincraciun7 2:036da44b023e 42
catalincraciun7 2:036da44b023e 43 this -> velocityY = newValue;
catalincraciun7 2:036da44b023e 44 }
catalincraciun7 2:036da44b023e 45
catalincraciun7 3:b1fde0759c94 46 bool ZumoRobotManager::checkPassword(char toCheck[]) {
catalincraciun7 3:b1fde0759c94 47
catalincraciun7 3:b1fde0759c94 48 if (toCheck[0] == '8' &&
catalincraciun7 3:b1fde0759c94 49 toCheck[1] == '1' &&
catalincraciun7 3:b1fde0759c94 50 toCheck[2] == '1' &&
catalincraciun7 3:b1fde0759c94 51 toCheck[3] == '1' &&
catalincraciun7 3:b1fde0759c94 52 toCheck[4] == '$')
catalincraciun7 3:b1fde0759c94 53 return true;
catalincraciun7 3:b1fde0759c94 54
catalincraciun7 3:b1fde0759c94 55 return false;
catalincraciun7 3:b1fde0759c94 56 }
catalincraciun7 3:b1fde0759c94 57
catalincraciun7 0:8ebbd2bd34f5 58 #endif // ZumoRobotManagerCpp