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: mbed
Diff: Control/drivecontrol.cpp
- Revision:
- 8:4a32fc9ee939
- Parent:
- 7:7215adbae3da
- Child:
- 12:6f48afe41cd9
diff -r 7215adbae3da -r 4a32fc9ee939 Control/drivecontrol.cpp
--- a/Control/drivecontrol.cpp Sun May 14 19:57:34 2017 +0000
+++ b/Control/drivecontrol.cpp Wed May 17 00:07:32 2017 +0000
@@ -4,10 +4,14 @@
#include "left_motor.h"
#include "right_motor.h"
#include "pin_assignment.h"
+//#include "encoder.h"
IRSensor leftIR(PA_8, PC_5);
IRSensor rightIR(PB_0, PA_4);
+//Encoder rightEncoder(PA_1, PA_0);
+//Encoder leftEncoder(PC_9, PC_8);
+
// Define states for debugging the mouse hardware
const int DRIVE = 0, TURN = 2, STOP = 4;
const int TURN_LEFT = 0, TURN_RIGHT = 1, TURN_AROUND = 2;
@@ -114,6 +118,11 @@
return DRIVE;
}
+void DriveControl::getEncoder(){
+ pc.printf("LeftEncoder Reading %d", leftEncoder.getEncoderDistance(1));
+ pc.printf("RightEncoder Reading %d\n\r", rightEncoder.getEncoderDistance(0));
+}
+
void DriveControl::turn_right() {
// TODO: Add PID Control
pid_controller::turn(TURN_RIGHT);