potmeter motor aansturing

Dependencies:   MODSERIAL mbed Project_script_encoder QEI

Fork of Project_script by Marijke Zondag

Revision:
17:741798018c0d
Parent:
16:5f7196ddc77b
Child:
18:898f54c6aa3d
diff -r 5f7196ddc77b -r 741798018c0d main.cpp
--- a/main.cpp	Mon Oct 22 12:04:18 2018 +0000
+++ b/main.cpp	Mon Oct 22 12:12:27 2018 +0000
@@ -15,9 +15,9 @@
 
 DigitalOut directionpin1    (D4);
 DigitalOut directionpin2    (D7);
-DigitalOut led1             (LED_RED);
-DigitalOut led2             (LED_BLUE);
-DigitalOut led3             (LED_GREEN);
+DigitalOut ledr             (LED_RED);
+DigitalOut ledb             (LED_BLUE);
+DigitalOut ledg             (LED_GREEN);
 
 PwmOut pwmpin1              (D5);
 PwmOut pwmpin2              (D6);
@@ -139,27 +139,27 @@
     
     if(x==0)                    //If x = 0, led is red
     {
-        led1 = 0;
-        led2 = 1;
-        led3 = 1;
+        ledr = 0;
+        ledb = 1;
+        ledg = 1;
     }
     else if (x==1)              //If x = 1, led is blue
     {
-        led1 = 1;
-        led2 = 0;
-        led3 = 1;
+        ledr = 1;
+        ledb = 0;
+        ledg = 1;
     }
     else if (x == 2)            //If x = 2, led is green
     {
-        led1 = 1;
-        led2 = 1;
-        led3 = 0;
+        ledr = 1;
+        ledb = 1;
+        ledg = 0;
     }
     else                        //If x > 3, led is white
     {
-        led1 = 0;
-        led2 = 0;
-        led3 = 0;
+        ledr = 0;
+        ledb = 0;
+        ledg = 0;
     }
    
     if(x>=4)                    //Reset back to x = 0
@@ -281,9 +281,9 @@
     //pc.baud(115200);
     //pc.printf("hello\n\r");
     
-    led1 = 0;       //Begin led = red, first state of calibration
-    led2 = 1;
-    led3 = 1;
+    ledr = 0;       //Begin led = red, first state of calibration
+    ledb = 1;
+    ledg = 1;
     
     filter_tick.attach(&emg_filtered,T);        //EMG signals filtered + moving average every T sec.
     button1.rise(switch_to_calibrate);          //Switch state of calibration (which muscle)