Bouke Scheltinga / Mbed 2 deprecated Werk_college_23sept

Dependencies:   Encoder HIDScope MODSERIAL mbed QEI biquadFilter

Files at this revision

API Documentation at this revision

Comitter:
bscheltinga
Date:
Wed Sep 30 15:31:10 2015 +0000
Parent:
4:96e47998d495
Child:
6:ca89d5e17328
Child:
9:832b48f48a10
Commit message:
Attempt to get the motorspeed variable to the potmeter

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 30 15:19:10 2015 +0000
+++ b/main.cpp	Wed Sep 30 15:31:10 2015 +0000
@@ -9,29 +9,14 @@
 DigitalIn buttonL2(PTA4);
 DigitalIn buttonH1(D2);
 DigitalIn buttonH2(D6);
+AnalogIn potmeter(A1);
 
-//dit kan worden gebruikt om de verschillende slagnelheden toe te passen door de buttons te veranderen in thresholds
 
 int main()
 {
+   double n = (potmeter.read()/1000);
     while(true) {
-        if (buttonL1.read() <0.5) {
-            motor2speed = 0.1;
-            motor2direction = 0;
-        }
-        if (buttonL2.read() <0.5) {
-            motor2speed = 0.4;
-            motor2direction = 0;
-        }
-        if (buttonH1.read() <0.5) {
-            motor2speed = 0.7;
-            motor2direction = 0;
-        }
-        if (buttonH2.read() <0.5) {
-            motor2speed = 0.99999;
-            motor2direction = 0;
-        } else {
-            motor2speed =0;
-        }
+        motor2direction = 1;
+        motor2speed = n;
     }
 }