![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
vf
Dependencies: Servo ServoArm mbed
Fork of PES_Official by
Diff: Sources/Robot.cpp
- Revision:
- 0:d267b248eff4
- Child:
- 1:388c915756f5
diff -r 000000000000 -r d267b248eff4 Sources/Robot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sources/Robot.cpp Sat Mar 11 10:14:00 2017 +0000 @@ -0,0 +1,62 @@ +#include "Robot.h" + +/* Work in progress -------------------------------------------- */ + +Robot::Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal) +{ + this->powerSignal = enableSignal; + this->left = left; + this->right = right; + + this->left->period(0.00005f); + this->right->period(0.00005f); +} + +/* work in progress ------------------------------------------- */ +void Robot::drive() +{ + //pwm determine what direction it goes. + *powerSignal = 1; + *left= 0.8f; + *right= 0.7f; + *left= 0.7f; + *right= 0.8f; +} + +void Robot::turnLeft(){ + *powerSignal = 1; + *left= 0.35f; + *right= 0.65f; + +} + +void Robot::turnRight(){ + *powerSignal = 1; + *left= 0.65f; + *right= 0.35f; +} + +void Robot::turnAround(int left){ + *powerSignal = 1; + + if (left){ + turnLeft(); + } + + else{ + turnRight(); + } +} + +//void Robot::init(){ +// Robot.DistanceSensors.init(&sensorVoltage, &bit0, &bit1, &bit2, ii); +//} + +//Remember to set +//DigitalOut powerMotor(PB_2) = 1; +//DigitalIn errorMotor(PB_14); +//if (errorMotor){ +//reset +//} + +//Add management for Overpower!! Pin PB_15 \ No newline at end of file