mbed_robotcar
/
Servo
サーボ制御
Revision 0:bccc9aa87794, committed 2020-07-13
- Comitter:
- tomotsugu
- Date:
- Mon Jul 13 03:27:34 2020 +0000
- Commit message:
- Servo
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Mon Jul 13 03:27:34 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/tomotsugu/code/Servo/#4c2104eb27a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jul 13 03:27:34 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resources/main.cpp Mon Jul 13 03:27:34 2020 +0000 @@ -0,0 +1,17 @@ +#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); + } + } +} \ No newline at end of file