NYP_Humanoid_robot_FYP_2018

Dependencies:   LSM6DSL

Fork of b_NYP_humanoid by Junjie Wang

Revision:
4:99891561a38b
Parent:
3:1345f959c490
Child:
5:1faeeab28bd1
diff -r 1345f959c490 -r 99891561a38b main.cpp
--- a/main.cpp	Wed May 02 07:49:13 2018 +0000
+++ b/main.cpp	Fri May 25 09:00:15 2018 +0000
@@ -1,33 +1,44 @@
 #include "mbed.h"
-#include "rtos.h"
 #include "servo.h"
 #include "accgyro.h"
-//Serial pc(USBTX, USBRX);
-DigitalOut led2(LED2);
-Thread event_thread;
+#include "behaviour.h"
+#include "kondo2.h"
+
+//Thread event_thread;
 Thread ACCGYRO_thread;
 Thread SERVO_thread;
+Thread BEHAVIOUR_thread;
 EventQueue event_queue;
+Thread KONDO1_thread;
+Thread KONDO2_thread;
+Thread KONDO3_thread;
+Thread KONDO1_Degrees_Set_thread;
+Thread KONDO2_Degrees_Set_thread;
 
 int main()
 {   
+    KONDO1_thread.start(KONDO1_init);
+    KONDO2_thread.start(KONDO2_init);
+    KONDO3_thread.start(KONDO3_init);
+    KONDO1_Degrees_Set_thread.start(KONDO1_Degrees_Set);
+    KONDO2_Degrees_Set_thread.start(KONDO2_Degrees_Set);
+    KONDO3_Degrees_Set_thread.start(KONDO3_Degrees_Set);
     ACCGYRO_thread.start(ACCGYRO_init);
-    SERVO_thread.start(SERVO_init);
+    //SERVO_thread.start(SERVO_init);
+    BEHAVIOUR_thread.start(BEHAVIOUR_init);
     //SERVO_init();
     //event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever));
     //ACCGYRO_init();
-    event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever));
+    //event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever));
     //Thread::wait(osWaitForever);
-    event_queue.call_every(1000, SERVO_task);
-    event_queue.call_every(1000, ACCGYRO_task);
+    //event_queue.call_every(1000, SERVO_task);
+    //event_queue.call_every(1000, ACCGYRO_task);
     //q.dispatch();
     //eventqueue.call_every(1000,printf,"LSM6DSL [acc/mg]:        %6ld\r\n", ACCGYRO_get_gyro_x());
     //q.dispatch();
     while(1)
     {
         //eventqueue.call(printf,"LSM6DSL [acc/mg]:        %6ld\r\n", ACCGYRO_get_gyro_x());
-        led2 = !led2;
-        wait(1);
         //q.dispatch();
         //q.call(printf, "*\n"); 
         //printf("*");
@@ -35,4 +46,4 @@
         //printf("LSM6DSL [acc/mg]:        %6ld\r\n", ACCGYRO_get_gyro_x());
         //printf("LSM6DSL [gyro/mdps]:     %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
     }
-}
\ No newline at end of file
+}