soft robotic fish 6 dummy test code for motors
Dependencies: mbed
Fork of robfish_test_pwm_allmotors by
Revision 1:1c924d93c011, committed 2016-03-30
- Comitter:
- rkk
- Date:
- Wed Mar 30 17:39:42 2016 +0000
- Parent:
- 0:c003ab5004eb
- Commit message:
- dummy code to test all motors
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c003ab5004eb -r 1c924d93c011 main.cpp --- a/main.cpp Sun Mar 20 02:58:11 2016 +0000 +++ b/main.cpp Wed Mar 30 17:39:42 2016 +0000 @@ -7,29 +7,53 @@ #include "mbed.h" using namespace std; -Serial pc(USBTX, USBRX); -AnalogIn valve_current(p19); -AnalogIn bcu_current(p20); +//Serial pc(USBTX, USBRX); +//AnalogIn valve_current(p19); +//AnalogIn bcu_current(p20); PwmOut valve_pwm(p21); PwmOut bcu_pwm(p22); PwmOut motor_pwm(p23); -DigitalOut led2(LED2); -DigitalOut bcu_direction1(p11); -DigitalOut bcu_direction2(p12); +//PwmOut led1(LED1); +//PwmOut led2(LED2); +PwmOut led3(LED3); +//DigitalOut bcu_direction1(p11); +//DigitalOut bcu_direction2(p12); int main() { // set serial transfer rate - pc.baud(9600); - - valve_pwm = 0.8; - bcu_pwm = 0.8; - motor_pwm = 0.8; + //pc.baud(9600)//; +// + valve_pwm = 0.0; +// led1 = 0.3; +// wait(4); +// valve_pwm = 0.0; +// led1 = 0.0; +// + bcu_pwm = 0.0; +// led2 = 0.3; +// bcu_direction1 = 0; // BCU_direction1 must not equal BCU_direction2 for the BCU motor to turn +// bcu_direction2 = 1; +// +// wait(4); +// bcu_direction1 = 1; // BCU_direction1 must not equal BCU_direction2 for the BCU motor to turn +// bcu_direction2 = 0; +// +// wait(4); +// +// bcu_pwm = 0.0; +// led2 = 0.0; - led2 = 1; - bcu_direction1 = 0; // BCU_direction1 must not equal BCU_direction2 for the BCU motor to turn - bcu_direction2 = 1; - - while(1) { - pc.printf("valve current percentage: %3.3f%%\n", valve_current.read()*100.0f); - } + + motor_pwm = 0.7; + led3 = 0.7; + wait(20); + motor_pwm = 0.0; + led3 = 0.0; + +// led2 = 1; +// +// while(1) { +// //pc.printf("valve current percentage: %3.3f%%\n", valve_current.read()*100.0f); +// wait(1); +// } } \ No newline at end of file