the fish that looks like a jet

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo

Files at this revision

API Documentation at this revision

Comitter:
sandwich
Date:
Fri Jan 24 21:58:04 2014 +0000
Parent:
2:430c068cf570
Parent:
1:80e0af42f876
Child:
4:f081a97ca000
Commit message:
merged changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp.orig Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jan 24 21:55:00 2014 +0000
+++ b/main.cpp	Fri Jan 24 21:58:04 2014 +0000
@@ -14,8 +14,8 @@
 Serial pc(USBTX, USBRX);
 
 //IMU imu(0.1, 0.3, 0.005, 0.005);
+void motor_thread(void const *args) {
 
-void motor_thread(void const *args) {
     Timer t;
     t.start();
     while (quit==false) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp.orig	Fri Jan 24 21:58:04 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "motor_controller.h"
+#include "guardian.h"
+#include "IMU.h"
+#include "Servo.h"
+#include "rtos.h"
+
+bool quit=false;
+
+PololuMController mcon(p22, p6, p5);
+Servo servo(p21);
+Guardian ap(p21, p23, p24, p25, p26, p26);
+Serial xbee(p13, p14);
+Serial pc(USBTX, USBRX);
+
+//IMU imu(0.1, 0.3, 0.005, 0.005);
+
+void motor_thread(void const *args) {
+    Timer t;
+    t.start();
+    while (quit==false) {
+        mcon.drive_sinusoidal(t.read(), 1, 2*3.14, 0);
+    }
+    t.stop();
+}
+
+int main()
+{
+    Thread thread(motor_thread);
+    ap.calibrate();
+    ap.set2D();
+    while(1) {
+        char buf[128];
+        if (xbee.readable())
+        {
+            xbee.gets(buf, 128);
+            pc.puts(buf);
+        }
+        memset(buf, 0, 128);
+    }
+}