ECE3872 HW/SW Project Code
Dependencies: mbed Servo mbed-rtos 4DGL-uLCD-SE PinDetect X_NUCLEO_53L0A1
motor_ctl.h
- Committer:
- trmontgomery
- Date:
- 2020-04-11
- Revision:
- 24:930fc58e927a
File content as of revision 24:930fc58e927a:
/*// Hello World to sweep a servo through its full range #include "mbed.h" #include "Servo.h" #include "rtos.h" Servo r_arm(p18); Servo l_arm(p19); //Servo r_leg(p20); //Servo l_leg(p21); Thread t_r_arm; Thread t_l_arm; //Thread t_r_leg; //Thread t_l_leg; DigitalOut led(LED4); //left sensor move whole left side //right sensor moves whole right side //not gonna think about this right now. Dicuss ideas with team. //and then the distance can just control the height //movement pattern can be random.. right now every other note recorded will be distributed to one side and the rest will go to the other float dists[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; //should I lock this or just make new arrs? float r_dists[] = {1,3,5,7,9,11,13,15,17,19}; float l_dists[] = {2,4,6,8,10,12,14,16,18,20}; void r_dance() { r_arm = 0; for(int i = 0; i < 10; ++i) { r_arm = r_dists[i]/20; wait(0.2); } } void l_dance() { l_arm = 0; for(int i = 0; i < 10; ++i) { l_arm = l_dists[i]/20; wait(0.2); } } void motor_ctl(){ t_r_arm.start(r_dance); t_l_arm.start(l_dance); } */