mbed_robotcar
/
Servo
サーボ制御
resources/main.cpp
- Committer:
- tomotsugu
- Date:
- 2020-07-13
- Revision:
- 0:bccc9aa87794
File content as of revision 0:bccc9aa87794:
#include "mbed.h" PwmOut pwm(p21); int main() { int start= 0, end= 180; while(1){ for(int p = start; p < end; p += 20 ) { pwm.pulsewidth_us(p); wait_ms(20); } for(int p = end; p >=start; p -= 20) { pwm.pulsewidth_us(p); wait_ms(20); } } }