yty gyvg

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
nicolasrojas
Date:
Thu Mar 08 02:46:17 2018 +0000
Commit message:
programa 1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 3f5935fe427c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 08 02:46:17 2018 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#define MAXPOS 50   
+#define SS_TIME 100     
+ 
+PwmOut myServoX(PB_3);
+PwmOut myServoY(PB_4);
+ 
+ 
+ 
+void vertex2d(float x, float y){
+ 
+    int pulseX =x*2000/50+500 ;
+    int pulseY =y*2000/50+500 ;
+ 
+  
+
+    
+    
+    myServoX.pulsewidth_us(pulseX);
+    myServoY.pulsewidth_us(pulseY);
+    wait_ms(SS_TIME);
+ 
+}
+ 
+ 
+int main() {
+     
+    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;
+        
+        
+     }
+ 
+}
+ 
\ No newline at end of file
diff -r 000000000000 -r 3f5935fe427c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 08 02:46:17 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5571c4ff569f
\ No newline at end of file