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.
Revision 2:aae3b2c0881c, committed 2015-12-17
- Comitter:
- gcarmonar
- Date:
- Thu Dec 17 18:24:42 2015 +0000
- Parent:
- 1:1bea5dcd4d6f
- Commit message:
- correciones d ebugs
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1bea5dcd4d6f -r aae3b2c0881c main.cpp
--- a/main.cpp Wed Dec 02 23:15:39 2015 +0000
+++ b/main.cpp Thu Dec 17 18:24:42 2015 +0000
@@ -2,7 +2,7 @@
#include "Servo.h"
#define MAXVEL 100 // From 100 max
-#define SERINC 0.1 // Move micro seconds up/down
+#define SERINC 100 // Move micro seconds up/down
DigitalOut myled(LED1);
@@ -30,6 +30,7 @@
c = bt.getc();
pc.printf("Received: %c\n\r", c);
decodeInstruction(c);
+ printf("%c\n", c);
}
}
@@ -88,11 +89,12 @@
}
void moveServo(int increment){
- pc.printf("%f\n\r", SARM);
- if (increment < 0 && SARM >= abs(increment)){
- SARM = SARM + increment;
- }else if (increment > 0 && SARM <= 1 - abs(increment)){
- SARM = SARM + increment;
+ float temp = 0.0;
+ temp = (float)increment / 100.0;
+ if (temp < 0 && SARM >= abs(temp)){
+ SARM = SARM + temp;
+ }else if (temp > 0 && SARM <= 1 - abs(temp)){
+ SARM = SARM + temp;
}
}