Lol smth

Dependencies:   LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed

Fork of TDP_main_BartFork by Yelfie

Revision:
10:c9212bbfeae6
Parent:
9:718987b106a8
Child:
11:9e56d52485d1
--- a/main.cpp	Mon Feb 23 16:49:59 2015 +0000
+++ b/main.cpp	Wed Feb 25 16:55:23 2015 +0000
@@ -15,17 +15,20 @@
 
 
 #include "mbed.h"
-#include "sensor_measure.h"
+//#include "sensor_measure.h"
 #include "Motor_Driver.h"
 //#include "Sensors.h"
 
 #define PWM_PERIOD_US 10000
 
 
+DigitalOut led(LED1);
 
-Serial pc(USBTX, USBRX);
+//Serial pc(USBTX, USBRX);
 
-Timer MeasureTimer; //Timer used for measurement
+//Timer MeasureTimer; //Timer used for measurement
+
+Motor_Driver motors(PTD4, PTA12, PTA4, PTA5, PTC9, PTC8, PWM_PERIOD_US);
 
 /*    For deleting
 double measure1 (){
@@ -56,37 +59,54 @@
 }
 */
 
-int main() {
+int main() {   
+    motors.setSpeed(0.5f);
+    motors.forward();
+    wait(1);
+    motors.start(0);
+    led = 0;
     
-    /*
-    Motor_Driver motors(PTD4, PTA12, PTA4, PTA5, PTC9, PTC8, PWM_PERIOD_US);
+    wait(2);
     
     motors.setSpeed(1.0f);
-    motors.forward();
-    motors.start();
+    
+    wait(2);
+    
+    led = 1;
+    
+    motors.stop(0);
     
     wait(3);
     
-    motors.stop()
     motors.reverse();
-    wait(200ms);
+    wait_ms(200);
     
-    motors.start();
-    */ 
- //   setup_counter(1000, 0);
-  //  float frequency = measure_frequency(CHANNEL_1);
+    motors.start(0);
+    wait(3);
+    motors.stop(0);
     
-    sensor_initialise(); // initialise sensor values
-    wait(1); //give time to set up the system
+    motors.setSteeringMode(PIVOT_CW);
     
-    sensorTimer.start(); // start timer for sensors
-    pc.printf("Start...");
-    MeasureTimer.start();
+    wait(1);
+    motors.start(0);
+    wait(2);
+    motors.stop(0);
+}
+
+/*int main()
+{
+    pc.baud(9600);
+    
+    start_systick();
     
-    while (1) {
-        MeasureTimer.reset();
-        measure(right_right);
-         pc.printf("Time taken for the whole thing is %f",MeasureTimer.read());
-    }
-        
-}
+    pc.printf("Started!");
+    
+    int frequency;
+    
+    while(1)
+    {
+        frequency = measure_clock_cycles(CHANNEL_1, 25);
+        pc.printf("Debug: %i\n", frequency);    
+        wait_ms(200);
+    }    
+}*/