Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:7460a219f05f
- Child:
- 1:757f571d9e14
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 14 09:52:37 2013 +0000 @@ -0,0 +1,51 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx +PwmOut servo1(p21); +PwmOut servo2(p22); +PwmOut servo3(p23); + +float p = 0.049f; +float q=0.097f; +float r=0.045f; + +int main() { + pc.printf("Press q e a d z c\n"); + servo1=p; + servo2=q; + servo3=r; + while(1) { + char c = pc.getc(); + if(c == 'q'){ + p += 0.001f; + servo1=p; + } + + if(c == 'e'){ + p -= 0.001f; + servo1 = p; + } if(c == 'a'){ + q += 0.001f; + servo2=q; + } + + if(c == 'd'){ + q -= 0.001f; + servo2 = q; + } if(c == 'z'){ + r += 0.001f; + servo3=r; + } + + if(c == 'c'){ + r -= 0.001f; + servo3=r; + } + + pc.printf("p=%f\n", p); + + pc.printf("q=%f\n", q); + + pc.printf("r=%f\n", r); + } +}