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.
Dependencies: mbed
Revision 1:e21d7c0748cf, committed 2015-11-16
- Comitter:
- spin7ion
- Date:
- Mon Nov 16 18:01:52 2015 +0000
- Parent:
- 0:e1d95cf9daa8
- Child:
- 2:f3268845c3b1
- Commit message:
- fixed bracket
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 16 17:43:35 2015 +0000 +++ b/main.cpp Mon Nov 16 18:01:52 2015 +0000 @@ -1,19 +1,20 @@ #include "mbed.h" -PwmOut servo(PWM_OUT); +PwmOut servo(PB_3); DigitalOut myled(LED1); int main() { int servopulsewidth=1500; int signer=1; + servo.period_us(20000); // servo requires a 20ms period servo.pulsewidth_us(servopulsewidth); wait(2); while (1) { servopulsewidth+=signer; - if(signer>0 && servopulsewidth>1990) + if(signer>0 && servopulsewidth>1990){ signer=-1; }else if(signer<0 && servopulsewidth<10){ signer=1;