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:50449384c230
- Parent:
- 1:40d2fd0b99e6
--- a/main.cpp Tue Nov 23 16:10:35 2010 +0000
+++ b/main.cpp Wed Jun 09 14:51:02 2021 +0000
@@ -3,11 +3,23 @@
#include "mbed.h"
#include "Servo.h"
-Servo myservo(p21);
+Servo myservo(D2);
+Servo myservo2(D3);
+
+AnalogIn pot1(A5);
+AnalogIn pot2(A0);
+
+Serial pc(USBTX,USBRX);
int main() {
- for(float p=0; p<1.0; p += 0.1) {
- myservo = p;
- wait(0.2);
+ pc.printf("\nSetup Complete\n");
+ while(1){
+ double pot1_val = pot1.read();
+ double pot2_val = pot2.read();
+ myservo = pot1_val;
+ myservo2=pot2_val;
+ pc.printf("S1\tS2\n");
+ pc.printf("%f\t%f\n", pot1_val, pot2_val);
}
+
}