Voor Maarten
Dependencies: MODSERIAL Servo mbed
Revision 0:c41f256db1d4, committed 2017-10-20
- Comitter:
- Jannes
- Date:
- Fri Oct 20 10:12:45 2017 +0000
- Commit message:
- Standard Servo Test
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Fri Oct 20 10:12:45 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#a3b2bc878529
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Fri Oct 20 10:12:45 2017 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 20 10:12:45 2017 +0000 @@ -0,0 +1,30 @@ +// Continuously sweep the servo through it's full range +#include "mbed.h" +#include "Servo.h" +#include "MODSERIAL.h" + +InterruptIn button3(D10); +Servo myservo(D9); +int k=0; + +//Other +MODSERIAL pc(USBTX, USBRX); + +int main() { + myservo.calibrate(0.005,60); + pc.baud(115200); + while(1) { + for(int i=0; i<100; i++) { + myservo = i/100; + wait(0.1); + float Posi = myservo.read(); + pc.printf("\r Position = %.4f \n",Posi); + } + for(int i=100; i>0; i--) { + myservo = i/100; + wait(0.1); + float Posi = myservo.read(); + pc.printf("\r Position = %.4f \n",Posi); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 20 10:12:45 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec \ No newline at end of file