ECE 4180 Mini Project Balancing Robot Nico van Duijn Samer Mabrouk 3/6/2015 This project consists of a robot balancing on two wheels. We use the 9-axis IMU LSM9DS0 to give us Accelerometer and Gyroscope data about the current angle and angular velocity of the robot. This data is then filtered using complementary filters and PID control to drive the two motors. The motors are controlled through digital outputs in their direction and their seepd by PWM using an H-bridge

Dependencies:   LSM9DS0 mbed

Revision:
1:bf71a7bd2d3e
Parent:
0:67f5b4041c15
Child:
2:ad080363a22c
--- a/main.cpp	Fri Mar 06 17:09:31 2015 +0000
+++ b/main.cpp	Fri Mar 06 17:12:47 2015 +0000
@@ -62,6 +62,7 @@
 #ifdef DEBUG
 void callback();                                                // Interrupt triggered function for serial communication
 #endif
+
 //////////////////////////////////////////////////////////////////
 // Main function
 int main()
@@ -80,6 +81,7 @@
 #endif
     }
 }
+
 /////////////////////////////////////////////////////////////////
 // Control function, implements PID
 void control()
@@ -98,6 +100,7 @@
     } else speed=0;                                             // If we've fallen over or are steady on top
     drive(speed);                                               // Write speed to the motors
 }
+
 //////////////////////////////////////////////////////////////////
 // Drive function
 void drive(float speed)
@@ -159,9 +162,9 @@
 #endif
 }
 
-#ifdef DEBUG
 /////////////////////////////////////////////////////////////////
 // Callback function to change values/gains
+#ifdef DEBUG
 void callback()
 {
     char val;                                                   // Needed for Serial communication (need to be global?)