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 Guntrigger by
Revision 2:629e8eb2c308, committed 2018-10-15
- Comitter:
- vinnypotente
- Date:
- Mon Oct 15 13:55:27 2018 +0000
- Parent:
- 1:a1880f0b0f04
- Commit message:
- added the comments
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 10 14:43:42 2018 +0000
+++ b/main.cpp Mon Oct 15 13:55:27 2018 +0000
@@ -1,7 +1,7 @@
#include "mbed.h"
#include "Servo.h"
-
-Servo myservo(p21);
+
+Servo myservo(p22);
float pos;
char c;
int main()
@@ -11,14 +11,20 @@
wait(1);
while (1) {
c = getchar ();
- for (pos =0.0; pos<=50.0; pos=pos+10.0) {
- myservo=(pos/50.0);
+ for (pos =0.0; pos<=40.0; pos=pos+10.0) {
+ myservo=(pos/90.0);
wait (0.07);
printf("%f\n",pos);
}
- wait(2.0);
- for (pos =50.0; pos>=0.0; pos=pos-10.0) {
- myservo=(pos/50.0);
+ wait(1.0); //shows the hand
+ for (pos =40.0; pos>=60.0; pos=pos+10.0) {
+ myservo=(pos/90.0);
+ wait (0.07);
+ printf("%f\n",pos);
+ }
+ wait (1.0); // moves hand forward to hit users hand
+ for (pos =60.0; pos>=0.0; pos=pos-10.0) {
+ myservo=(pos/90.0);
wait (0.07);
printf("%f\n",pos);
}
