NYP_Humanoid_robot_FYP_2018

Dependencies:   LSM6DSL

Fork of b_NYP_humanoid by Junjie Wang

main.cpp

Committer:
mr_wang
Date:
2018-05-25
Revision:
4:99891561a38b
Parent:
3:1345f959c490
Child:
5:1faeeab28bd1

File content as of revision 4:99891561a38b:

#include "mbed.h"
#include "servo.h"
#include "accgyro.h"
#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);
    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));
    //Thread::wait(osWaitForever);
    //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());
        //q.dispatch();
        //q.call(printf, "*\n"); 
        //printf("*");
        //Thread::wait(1000);
        //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]);
    }
}