2014 Eurobot fork
Dependencies: mbed-rtos mbed QEI
Diff: main.cpp
- Revision:
- 65:4709ff6c753c
- Parent:
- 59:63609922579c
- Child:
- 67:be3ea5450cc7
--- a/main.cpp Sat Apr 13 22:42:01 2013 +0000 +++ b/main.cpp Sun Apr 14 17:57:12 2013 +0000 @@ -39,8 +39,8 @@ //motorencodetest(); //motorencodetestline(); //motorsandservostest(); - armtest(); - while(1); + //armtest(); + //while(1); //motortestline(); //ledtest(); //phototransistortest(); @@ -245,22 +245,74 @@ } } */ +#ifdef AGDHGADSYIGYJDGA +PwmOut white(p26); +PwmOut black(p25); - +void armtest() +{ + + white.period(0.05); + black.period(0.05); + + /* float f=1; + for (f=1; f<3; f+=0.1) + { + black.pulsewidth_us(f*1000); + wait(1); + printf("%f\r\n", f); + } + for (f=2; f>0; f-=0.1) + { + black.pulsewidth_us(f*1000); + wait(1); + printf("%f\r\n", f); + }*/ + + + for(;;) + { + black.pulsewidth_us(2.0*1000); + wait(2); + black.pulsewidth_us(0.9*1000);//1.2 + wait(2); + } + + // white works + /*for(;;) + { + white.pulsewidth_us(0.6*1000); + wait(2); + white.pulsewidth_us(2.5*1000); + wait(2); + }*/ + + /* while(1) //2.5 -> //0.6 + { + white.pulsewidth_us(int(f*1000)); + printf("%f\r\n", f); + f-=0.1; + wait(1); + }*/ +} +#endif +#ifdef FSDHGFSJDF void armtest() { - Arm white(p26), black(p25, false, 0.0005, 180); - while(true) { - white(0); - black(0.2); - wait(1); - white(1); - black(0.8); - wait(1); + Arm lower_arm(p25, 0.05, 0.9, 2.0); + Arm upper_arm(p26, 0.05, 0.6, 2.5); + + while(1) + { + upper_arm.go_up(); + wait(2); + upper_arm.go_down(); + wait(2); } } - - +#endif +void armtest(){} +/* void motorsandservostest() { Encoder Eleft(p27, p28), Eright(p30, p29); @@ -301,7 +353,7 @@ if (servoTimer.read() >= 9) servoTimer.reset(); } } - +*/ void motortestline() { MainMotor mleft(p24,p23), mright(p21,p22);