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:
- namcheol
- Date:
- 2020-04-21
- Revision:
- 1:89d23c8072af
- Parent:
- 0:f31836d48420
File content as of revision 1:89d23c8072af:
#include "mbed.h"
PwmOut servo(PTA1); //servo = PTA1
int main()
{
float w;
servo.period(20.0 / 1000.0); //period = 20ms for SG90 servo
while (true) { //500 ~ 2500us for degree 0 to 180
for(w = 500; w <= 2500; w += 100) {
servo.write(w / (20.0 * 1000.0));
thread_sleep_for(1000);
}
}
}