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
main.cpp
- Committer:
- spin7ion
- Date:
- 2015-11-16
- Revision:
- 0:e1d95cf9daa8
- Child:
- 1:e21d7c0748cf
File content as of revision 0:e1d95cf9daa8:
#include "mbed.h" PwmOut servo(PWM_OUT); 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) signer=-1; }else if(signer<0 && servopulsewidth<10){ signer=1; } servo.pulsewidth_us(servopulsewidth); wait(0.25); } }