GDP 4
/
mbed_transferfunction
Steering Servo Step responses
Diff: main.cpp
- Revision:
- 0:4a3f069b314a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 24 10:39:45 2016 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" +#include "TFC.h" +#define MULTIPLIER 0.25 + +DigitalOut gpo(D0); + +int main() +{ + TFC_Init(); + TFC_InitServos(0.00052,0.00122,0.02); + float i; + wait(3); + float rand_max=RAND_MAX; + while(true) + { + i = (rand()/rand_max)*MULTIPLIER; + + + + + gpo = !gpo; // toggle pin + TFC_SetServo(0,-1.0); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,0.4); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,0); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,-0.6); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,-0.5); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,-0.7); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,0.9); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + gpo = !gpo; + TFC_SetServo(0,0.5); + wait(i); + i = (rand()/rand_max)*MULTIPLIER; + + } + } \ No newline at end of file