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.
Diff: main.cpp
- Revision:
- 2:7709000dbbc4
- Parent:
- 1:40d2fd0b99e6
- Child:
- 3:600b3ff627a2
--- a/main.cpp Tue Nov 23 16:10:35 2010 +0000
+++ b/main.cpp Thu May 06 02:22:30 2021 +0000
@@ -1,13 +1,27 @@
-// Hello World to sweep a servo through its full range
+/*
+Program MyServo_HelloWorld
+
+Hello World to sweep a servo through its full range. Based on example by
+Simon Ford. Minor modifications by Dr. C. S. Tritt.
+
+Last revised 5/5/21 ( v. 0.9)
+*/
#include "mbed.h"
#include "Servo.h"
-Servo myservo(p21);
+Servo myServo(D8);
-int main() {
- for(float p=0; p<1.0; p += 0.1) {
- myservo = p;
+int main() {
+ for (int q=1; q < 6; q++) {
+ for (float p=0; p < 1.0; p += 0.1) {
+ myServo = p;
+ wait(0.2);
+ }
+ }
+ while (true) {
+ float hold = 0.5;
+ myServo = hold; // Wait here forever.
wait(0.2);
}
-}
+}
\ No newline at end of file