ferney alberto beltran molina
/
01-01EjercicioFuncionXY
se debe completar el código que falta de la función vertex2d para generar la figura
Diff: main.cpp
- Revision:
- 0:7ba873404776
- Child:
- 1:370d6730c1cf
diff -r 000000000000 -r 7ba873404776 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 20 00:25:00 2018 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#define MAXPOS 50 // en milimetros +#define SS_TIME 100 // en microsegundos + +PwmOut myServoX(PB_3); +PwmOut myServoY(PB_4); + + + +void vertex2d(float x, float y){ + + // UBICAR EL CODIGO QUE HACE FALTA + + myServoX.pulsewidth_us(pulseX); + myServoY.pulsewidth_us(pulseY); + wait_ms(SS_TIME); + +} + + +int main() { + // configuracion de periodo + myServoX.period_ms(20); + myServoY.period_ms(20); + int posx=0; + int posy=0; + while(1) + { + wait(2); + vertex2d(posx,posy); + posx+=10; + posy+=10; + if (posx>50) posx=0; + if (posy>50) posy=0; + } + +} +