NYP_Humanoid_robot_FYP_2018

Dependencies:   LSM6DSL

Fork of b_NYP_humanoid by Junjie Wang

Committer:
mr_wang
Date:
Fri May 25 09:00:15 2018 +0000
Revision:
4:99891561a38b
Parent:
3:1345f959c490
Child:
5:1faeeab28bd1
NYP_DAD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mr_wang 0:0ea84b3cf851 1 #include "mbed.h"
mr_wang 3:1345f959c490 2 #include "servo.h"
mr_wang 0:0ea84b3cf851 3 #include "accgyro.h"
mr_wang 4:99891561a38b 4 #include "behaviour.h"
mr_wang 4:99891561a38b 5 #include "kondo2.h"
mr_wang 4:99891561a38b 6
mr_wang 4:99891561a38b 7 //Thread event_thread;
mr_wang 3:1345f959c490 8 Thread ACCGYRO_thread;
mr_wang 3:1345f959c490 9 Thread SERVO_thread;
mr_wang 4:99891561a38b 10 Thread BEHAVIOUR_thread;
mr_wang 3:1345f959c490 11 EventQueue event_queue;
mr_wang 4:99891561a38b 12 Thread KONDO1_thread;
mr_wang 4:99891561a38b 13 Thread KONDO2_thread;
mr_wang 4:99891561a38b 14 Thread KONDO3_thread;
mr_wang 4:99891561a38b 15 Thread KONDO1_Degrees_Set_thread;
mr_wang 4:99891561a38b 16 Thread KONDO2_Degrees_Set_thread;
mr_wang 0:0ea84b3cf851 17
mr_wang 0:0ea84b3cf851 18 int main()
ha731548874 2:7d574b1ab3cd 19 {
mr_wang 4:99891561a38b 20 KONDO1_thread.start(KONDO1_init);
mr_wang 4:99891561a38b 21 KONDO2_thread.start(KONDO2_init);
mr_wang 4:99891561a38b 22 KONDO3_thread.start(KONDO3_init);
mr_wang 4:99891561a38b 23 KONDO1_Degrees_Set_thread.start(KONDO1_Degrees_Set);
mr_wang 4:99891561a38b 24 KONDO2_Degrees_Set_thread.start(KONDO2_Degrees_Set);
mr_wang 4:99891561a38b 25 KONDO3_Degrees_Set_thread.start(KONDO3_Degrees_Set);
mr_wang 3:1345f959c490 26 ACCGYRO_thread.start(ACCGYRO_init);
mr_wang 4:99891561a38b 27 //SERVO_thread.start(SERVO_init);
mr_wang 4:99891561a38b 28 BEHAVIOUR_thread.start(BEHAVIOUR_init);
mr_wang 3:1345f959c490 29 //SERVO_init();
mr_wang 3:1345f959c490 30 //event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever));
mr_wang 3:1345f959c490 31 //ACCGYRO_init();
mr_wang 4:99891561a38b 32 //event_thread.start(callback(&event_queue, &EventQueue::dispatch_forever));
mr_wang 0:0ea84b3cf851 33 //Thread::wait(osWaitForever);
mr_wang 4:99891561a38b 34 //event_queue.call_every(1000, SERVO_task);
mr_wang 4:99891561a38b 35 //event_queue.call_every(1000, ACCGYRO_task);
mr_wang 0:0ea84b3cf851 36 //q.dispatch();
mr_wang 0:0ea84b3cf851 37 //eventqueue.call_every(1000,printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x());
mr_wang 0:0ea84b3cf851 38 //q.dispatch();
mr_wang 0:0ea84b3cf851 39 while(1)
mr_wang 0:0ea84b3cf851 40 {
mr_wang 3:1345f959c490 41 //eventqueue.call(printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x());
mr_wang 0:0ea84b3cf851 42 //q.dispatch();
mr_wang 0:0ea84b3cf851 43 //q.call(printf, "*\n");
mr_wang 0:0ea84b3cf851 44 //printf("*");
mr_wang 0:0ea84b3cf851 45 //Thread::wait(1000);
mr_wang 0:0ea84b3cf851 46 //printf("LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x());
mr_wang 0:0ea84b3cf851 47 //printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
mr_wang 0:0ea84b3cf851 48 }
mr_wang 4:99891561a38b 49 }