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
Diff: main.cpp
- Revision:
- 0:7ba873404776
- Child:
- 1:370d6730c1cf
--- /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;
+ }
+
+}
+
