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-01Solucionfuncionservo by
Diff: main.cpp
- Revision:
- 5:ffac1facf6c7
- Parent:
- 3:fe8e265eaf6e
- Child:
- 6:9b41d99d6490
--- a/main.cpp Wed Mar 07 00:10:11 2018 +0000
+++ b/main.cpp Mon Sep 03 17:37:52 2018 +0000
@@ -1,5 +1,5 @@
#include "mbed.h"
-#define MAXPOS 50 // en milimetros
+#define MAXPOS 180 // en milimetros
#define SS_TIME 100 // en microsegundos
#define POSDRAW 10
@@ -11,7 +11,7 @@
int coord2us(float coord)
{
if(0 <= coord <= MAXPOS)
- return int(750+coord*1900/50);// u6
+ return int(750+coord*1900/180);// u6
return 750;
}
@@ -50,13 +50,18 @@
{
wait(2);
vertex2d(posx,posy);
- posx+=10;
- if (posx>50){
+ posx+=90;
+ posy+=90;
+ if (posx>180){
posx=0;
nodraw();
}
- posy=posy;
- }
+ if (posy>180){
+ posy=0;
+ nodraw();
+ }
+
+ }
}
