Junjie Wang
/
humanoid
NYP
Fork of a_NYP_humanoid by
Diff: main.cpp
- Revision:
- 3:1345f959c490
- Parent:
- 2:7d574b1ab3cd
--- a/main.cpp Wed May 02 03:33:15 2018 +0000 +++ b/main.cpp Wed May 02 07:49:13 2018 +0000 @@ -1,29 +1,31 @@ #include "mbed.h" #include "rtos.h" - +#include "servo.h" #include "accgyro.h" //Serial pc(USBTX, USBRX); DigitalOut led2(LED2); -Thread eventthread; -EventQueue eventqueue; +Thread event_thread; +Thread ACCGYRO_thread; +Thread SERVO_thread; +EventQueue event_queue; int main() { - SERVO_init(); - ACCGYRO_init(); - eventthread.start(callback(&eventqueue, &EventQueue::dispatch_forever)); - //ACCGYRO_thread.start(ACCGYRO_init); + ACCGYRO_thread.start(ACCGYRO_init); + SERVO_thread.start(SERVO_init); + //SERVO_init(); + //event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever)); + //ACCGYRO_init(); + event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever)); //Thread::wait(osWaitForever); - //eventqueue.call_every(1000, SERVO_task); - eventqueue.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()); + //eventqueue.call(printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); led2 = !led2; wait(1); //q.dispatch();