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-17
- Revision:
- 3:c5a79dbed82b
- Parent:
- 2:f3268845c3b1
- Child:
- 4:0b614835f104
File content as of revision 3:c5a79dbed82b:
#include "mbed.h" PwmOut servo(PB_3); PwmOut servo2(PB_4); DigitalOut myled(LED1); int main() { int servopulsewidth=15000; 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>19900){ signer=-1; }else if(signer<0 && servopulsewidth<10){ signer=1; } servo.pulsewidth_us(servopulsewidth); servo2.pulsewidth_us(servopulsewidth); wait(0.25); } }