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:
- 3:65416d9052dd
- Parent:
- 0:047ab874a574
- Child:
- 4:5ba96337741c
--- a/main.cpp Mon Oct 22 12:25:42 2018 +0000
+++ b/main.cpp Mon Oct 22 12:43:34 2018 +0000
@@ -14,10 +14,10 @@
// Connections to hardware defined here
Serial pc(USBTX,USBRX); // connection to laptop for debugging
Motor m(p26, p30, p29); //launches the cover
-Servo herndon_servo(p21); //servo to move monument on turn table
+Servo herndon_servo(p23); //servo to move monument on turn table
Servo angle(p22); //servo to adjust horizontal angle of arm
-DigitalIn herndon_sw1(p25); //moves herndon monument on turn table continuously while switch is on
-AnalogIn turn(p15); //turn dial to adjust servo for horizontal angle of arm SWITCH 2
+DigitalIn herndon_sw1(p17); //moves herndon monument on turn table continuously while switch is on
+AnalogIn turn(p16); //turn dial to adjust servo for horizontal angle of arm SWITCH 2
DigitalIn swtch3(p18); //releases the cover when switch 3 is turned on
DigitalIn swtch4(p19); //retracts arm back to starting position to try again
@@ -121,10 +121,15 @@
while(1) {
if (herndon_sw1.read()) {
+ printf("Herdnon is at %f\n", x);
+
x = x + xinc;
if (x > 1.0) {
x = 1.0;
xinc = -0.1;
+
+ printf("Herdnon is at %f\n", x);
+
} // hit the right end
else if (x < 0.0) {
x = 0.0;
@@ -135,6 +140,9 @@
else {
herndon_servo.write(0.0);
+
+ printf("Herdnon is at %f\n", x);
+
} // s1 if off
ThisThread::sleep_for(200); // change this number if too fast or too slow

