サーボをパルスで制御しています。バグ、質問等は中田までよろしく。
Dependencies: mbed
Fork of BusOut_HelloWorld by
Diff: main.cpp
- Revision:
- 2:e6fae83a99c1
- Parent:
- 0:717993c337df
--- a/main.cpp Sat Sep 20 23:03:03 2014 +0000 +++ b/main.cpp Thu Dec 18 06:56:54 2014 +0000 @@ -1,12 +1,15 @@ #include "mbed.h" - -BusOut myleds(LED1, LED2, LED3, LED4); - -int main() { - while(1) { - for(int i=0; i<16; i++) { - myleds = i; - wait(0.25); - } +PwmOut ser(p21); + +int main(){ + ser.period_ms(17); + ser.pulsewidth_ms(2.3); + wait(1); + while(1){ + ser.pulsewidth_ms(1.5); + wait(1); + ser.pulsewidth_ms(2.3); + wait(1); } -} \ No newline at end of file +} + \ No newline at end of file