ferney alberto beltran molina
/
00_LAB_PWM_1SERVO_clase1
evaluación básica de conocimientos
main.cpp
- Committer:
- fabeltranm
- Date:
- 2018-02-19
- Revision:
- 1:947d30f0d240
- Parent:
- 0:52095c095cf0
File content as of revision 1:947d30f0d240:
#include "mbed.h" PwmOut myservo1(PB_3); DigitalOut myled(LED1); int main() { myservo1.period_ms(20); int cw=1; int dpulse=500; myservo1.pulsewidth_us(dpulse); while(1) { myled = 1; if (dpulse==500) cw=1; if (dpulse==2300) cw=0; if (cw==1) dpulse+=100; else dpulse-=100; myservo1.pulsewidth_us(dpulse); wait(1); } }