Werkcollege opgave 23 september BMT K9

Dependencies:   Encoder HIDScope MODSERIAL mbed QEI biquadFilter

Revision:
5:d60a42727a3e
Parent:
4:96e47998d495
Child:
6:ca89d5e17328
Child:
9:832b48f48a10
--- 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;
     }
 }