Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of 01-01SolucionFuncionXY by
main.cpp
- Committer:
- fabeltranm
- Date:
- 2018-02-20
- Revision:
- 0:7ba873404776
- Child:
- 1:370d6730c1cf
File content as of revision 0:7ba873404776:
#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;
}
}
