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.
Diff: main.cpp
- Revision:
- 2:812701011676
- Parent:
- 1:74a29b62a144
- Child:
- 3:198ec91cec19
--- a/main.cpp Sat Sep 20 06:50:43 2014 +0000 +++ b/main.cpp Sat Oct 11 08:52:35 2014 +0000 @@ -1,32 +1,19 @@ #include "mbed.h" -#include "ExtendedServo.h" +//#include "ExtendedServo.h" +#include "DelayServo.h" DigitalOut myled(LED1); int main() { //PwmServo a(PB_8); - ExtendedServo b(PB_10, 170, 5, 90, false); - + //ExtendedServo b(PB_10, 170, 5, 90, false); + DelayServo b(PB_10, 10, 10000, 170, 5, 90, false);//10度刻みで50ms毎に角度を更新 + while(1) { - // a.setAngle(54); - //b.setAngle(-90); - //wait_ms(2000); - b.setAngle(0); - //wait_ms(2000); - //b.setAngle(90); - //wait_ms(2000); - //b.setAngle(0); - //wait_ms(2000); - - for (int i = -90; i < 90 ;i++) { - b.setAngle(i); - wait_ms(10); - } - for (int i = 90; i > -90; i--) { - b.setAngle(i); - wait_ms(10); - } - + b.setAngle(-90); + wait_ms(2000); + b.setAngle(90); + wait_ms(2000); } }