David's dead reckoning code for the LVBots competition on March 6th. Uses the mbed LPC1768, DRV8835, QTR-3RC, and two DC motors with encoders.

Dependencies:   PololuEncoder Pacer mbed GeneralDebouncer

Files at this revision

API Documentation at this revision

Comitter:
DavidEGrayson
Date:
Thu Feb 20 02:11:09 2014 +0000
Child:
1:d0d9653a4547
Commit message:
Got basics working. See commit for library.

Changed in this revision

PololuEncoder.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PololuEncoder.lib	Thu Feb 20 02:11:09 2014 +0000
@@ -0,0 +1,1 @@
+PololuEncoder#82ccff71d12a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 20 02:11:09 2014 +0000
@@ -0,0 +1,27 @@
+#include <mbed.h>
+#include "PololuEncoder.h"
+
+DigitalOut myled(LED1);
+
+Serial pc(USBTX, USBRX);
+
+#define ENCODER1 0x00
+
+PololuEncoderBuffer encoderBuffer;
+PololuEncoder encoder1(p6, p7, &encoderBuffer, ENCODER1);
+//PololuEncoder encoder1(p6, p7, ENCODER1);
+
+int main() {
+    while(1) {
+        //pc.printf("Encoder: %d\n", encoder1.getCounts());          
+        while(encoderBuffer.hasEvents())
+        {
+            PololuEncoderEvent event = encoderBuffer.readEvent();
+            pc.printf("%x\n", event);
+        }
+        myled = 1;
+        wait(0.1);
+        myled = 0;
+        wait(0.1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 20 02:11:09 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file