Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Revision:
3:880f15be8c72
Parent:
2:771db996cee0
Child:
4:b5b7836ca2b0
--- a/main.cpp	Thu Apr 27 22:02:14 2017 +0000
+++ b/main.cpp	Fri Apr 28 01:08:29 2017 +0000
@@ -2,12 +2,13 @@
 #include <stdlib.h>
 #include "ITG3200.h"
 
+
 DigitalOut redLed(PC_0);
 DigitalOut blueLed(PC_1);
 DigitalOut greenLed(PC_2);
 
-DigitalOut IR_1(PB_13);
-DigitalOut IR_2(PB_1);
+DigitalOut IR_1(PB_1);
+DigitalOut IR_2(PB_13);
 DigitalOut IR_3(PB_0);
 DigitalOut IR_4(PB_14);
 
@@ -20,23 +21,37 @@
 
 ITG3200 gyro(PC_9, PA_8);
 
+
+volatile double reading = 0;
+
+int gyroX = 0;
+int gyroY = 0;
+int gyroZ = 0;
+
 int main()
 {
+    //Set highest bandwidth.
     gyro.setLpBandwidth(LPFBW_42HZ);
-    
+    serial.baud(9600);
+       
     wait (0.1);
-    serial.printf("%i, %i, %i\n", gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ());
-        
-    //IR_1.write(1);
+    
+//    IR_1.write(1);
 //    IR_2.write(1);
 //    IR_3.write(1);
 //    IR_4.write(1);
-    
+
     redLed.write(1);
     greenLed.write(0);
     blueLed.write(1);
     
-    //while (1) {
+    while (1) {
+        
+        wait(0.1);
+        serial.printf("%i, %i, %i\n", gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ());
+            
+        //reading = Rec_4.read();
+//        serial.printf("reading: %f\n", reading);
 //        redLed.write(0);
 //        wait_ms(1000);
 //        redLed.write(1);
@@ -46,5 +61,5 @@
 //        blueLed.write(0);
 //        wait_ms(1000);
 //        blueLed.write(1);
-//    }
+    }
 }