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-20
- Revision:
- 5:d4e53f381e99
- Parent:
- 4:0b614835f104
File content as of revision 5:d4e53f381e99:
#include "mbed.h" PwmOut servo(PB_3); PwmOut servo2(PB_4); DigitalOut myled(LED1); int main() { int servopulsewidth=1500; int signer=1; servo.period_us(20000); // servo requires a 20ms period servo2.period_us(20000); // servo requires a 20ms period servo.pulsewidth_us(servopulsewidth); servo2.pulsewidth_us(servopulsewidth); wait(2); while (1) { servopulsewidth+=signer; if(signer>0 && servopulsewidth>1990){ signer=-1; }else if(signer<0 && servopulsewidth<1000){ signer=1; } servo.pulsewidth_us(servopulsewidth); servo2.pulsewidth_us(servopulsewidth); wait(0.05); } }