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.
main.cpp
- Committer:
- S1lverEagle
- Date:
- 2015-10-02
- Revision:
- 0:952a13a3eb5c
- Child:
- 1:c6e4257722b9
File content as of revision 0:952a13a3eb5c:
#include "mbed.h"
//servo ranges from .6ms to 2.7ms duty cycle in 20ms pwm period
PwmOut servoPwm(D5);
DigitalIn button1(SW2);
DigitalIn button2(SW3);
int main()
{
servoPwm.period(0.020);
while(1) {
if (button1 == 0) {
servoPwm.pulsewidth(0.0027);
} else if (button2 == 0) {
servoPwm.pulsewidth(0.0006);
} else {
servoPwm.pulsewidth(0.00165);
}
}
}