Frank Girald
/
Servo
Servo Motor
Fork of Servo_HelloWorld by
main.cpp
- Committer:
- franni
- Date:
- 2017-10-26
- Revision:
- 2:115ddb84b970
- Parent:
- 1:40d2fd0b99e6
File content as of revision 2:115ddb84b970:
#include "mbed.h" #include "Servo.h" Serial rs232(USBTX, USBRX); Servo servomotor(PTE29); // PIN PWM int grados,k; int main() { rs232.baud(9600); while(1) { grados=0;k=0; for(float i=0; i<1.0; i += 0.08333) { // 12 pasos de 15° (0 a 180° entre 0 y 1.0 mseg: 0.08333mseg por paso) servomotor = i; wait(0.5); grados=k*15; rs232.printf("%d \r\n",grados); //Visualiza avance cada 15° ++k; } } }