Initial Commit

Dependencies:   mbed HC05 QEI MODSERIAL SWSPI mbed-rtos

Revision:
0:43331220df0d
Child:
1:1da89c13dfa1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 05 15:27:32 2014 +0000
@@ -0,0 +1,60 @@
+#include "QEI.h"
+#include "mbed.h"
+#include "robot.h"
+#include "rtos.h"
+#define ulrL PTD6
+#define ulR PTD5
+#define ulF PTD1
+#define ulrR PTC2
+#define ulB PTC1
+#define ulL PTC0
+AnalogIn uL(ulL);
+AnalogIn uF(ulF);
+AnalogIn uR(ulR);
+AnalogIn urR(ulrR);
+AnalogIn urL(ulrL);
+char c;
+int main() {
+     initRobot();
+     Thread buzzer_th(pl_buzzer, NULL, osPriorityNormal, 2048, NULL);
+     motor_control(lMotor*m_speed,rMotor*m_speed);
+    while(1){
+       //bt.printf("Pulses is:   Revolutions is: \r\n");
+      //bt.lock();
+       // bt.printf("LDR1_%lf;LDR2_%lf;Pulses is: %i  Revolutions is: %i Pulses is: %i  ultrasonic: , \r\n",ldrread1(),ldrread2(), left.getPulses(), left.getRevolutions(),right.getPulses());//, uL.read()*5*102.54*2.54);
+        //bt.printf("s;LDR1_%lf;LDR2_%lf;Pulses is:  %i ; %i:s\n\r",ldrread1(),ldrread2(),wheel.getPulses(), wheel.getRevolutions());
+       // motor_control(lMotor*m_speed,rMotor*m_speed);
+         //bt.unlock(); 
+        if(bt.readable()){
+        c = bt.getc();
+        if(c=='?')
+        {
+            bt.lock();
+            bt.printf("EBOTDEMO\n");
+            bt.unlock(); 
+        }
+       /* int number = (c-'0');
+        stdio_mutex.lock();
+        freq = number;
+        stdio_mutex.unlock();
+        motor_control(0,0);
+        
+        */}
+         if(ldrread1()>0.6)
+    {
+        //pl_buzzer(); 
+        
+    }
+    if(ldrread2()>0.6)
+    { 
+        Led_on();
+    }
+     else
+    {
+       Led_off();
+    }
+        //Thread::wait(1);
+    Thread::wait(50);
+   
+   }
+}
\ No newline at end of file