Charles Tritt / Mbed 2 deprecated MyServo_HelloWorld

Dependencies:   mbed Servo

Committer:
CSTritt
Date:
Thu May 06 02:22:30 2021 +0000
Revision:
2:7709000dbbc4
Parent:
1:40d2fd0b99e6
Child:
3:600b3ff627a2
This is the initial version of my servo Hello World demo program.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
CSTritt 2:7709000dbbc4 1 /*
CSTritt 2:7709000dbbc4 2 Program MyServo_HelloWorld
CSTritt 2:7709000dbbc4 3
CSTritt 2:7709000dbbc4 4 Hello World to sweep a servo through its full range. Based on example by
CSTritt 2:7709000dbbc4 5 Simon Ford. Minor modifications by Dr. C. S. Tritt.
CSTritt 2:7709000dbbc4 6
CSTritt 2:7709000dbbc4 7 Last revised 5/5/21 ( v. 0.9)
CSTritt 2:7709000dbbc4 8 */
simon 1:40d2fd0b99e6 9
simon 1:40d2fd0b99e6 10 #include "mbed.h"
simon 1:40d2fd0b99e6 11 #include "Servo.h"
simon 1:40d2fd0b99e6 12
CSTritt 2:7709000dbbc4 13 Servo myServo(D8);
simon 1:40d2fd0b99e6 14
CSTritt 2:7709000dbbc4 15 int main() {
CSTritt 2:7709000dbbc4 16 for (int q=1; q < 6; q++) {
CSTritt 2:7709000dbbc4 17 for (float p=0; p < 1.0; p += 0.1) {
CSTritt 2:7709000dbbc4 18 myServo = p;
CSTritt 2:7709000dbbc4 19 wait(0.2);
CSTritt 2:7709000dbbc4 20 }
CSTritt 2:7709000dbbc4 21 }
CSTritt 2:7709000dbbc4 22 while (true) {
CSTritt 2:7709000dbbc4 23 float hold = 0.5;
CSTritt 2:7709000dbbc4 24 myServo = hold; // Wait here forever.
simon 1:40d2fd0b99e6 25 wait(0.2);
simon 1:40d2fd0b99e6 26 }
CSTritt 2:7709000dbbc4 27 }