control for robotic arm that can play chess using a granular gripper

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

Revision:
35:e26a573e3e9f
Parent:
34:f315b2b38555
Child:
36:6f9670eb9168
--- a/buttons.cpp	Wed Oct 07 19:04:09 2015 +0000
+++ b/buttons.cpp	Wed Oct 07 22:46:52 2015 +0200
@@ -9,11 +9,12 @@
 
 // Led states: 	
 // 	0 leds: motors disabled
-//	led1: 	control X speed
-//	led2:	control Y speed
-//	led1&led2: control Servo pos
-AnalogOut led1(led1Pin);
-AnalogOut led2(led2Pin);
+//	redLed: 	control X speed
+//	greenLed:	control Y speed
+//	blueLed:	control Servo pos
+DigitalOut redLed(RED_LED);
+DigitalOut greenLed(GREEN_LED);
+DigitalOut blueLed(BLUE_LED);
 
 AnalogIn button1(button1Pin);
 AnalogIn button2(button2Pin);
@@ -49,20 +50,20 @@
     if(motorsEnable){
     	switch (actuatorState){
         	case 0: 				// potmeters control X speed
-        		led1 = 1; led2=0;
+        		redLed.write(0); greenLed.write(1); blueLed(1);
         		motorSetSpeed1 = 300*(pot2.read()-pot1.read());
         		break;
         	case 1:         		// potmeters control Y speed
-        		led1=0; led2=1;
+        		redLed.write(1); greenLed.write(0); blueLed(1);
         		motorSetSpeed2 = 300*(pot2.read()-pot1.read());
         		break;
         	case 2:         		// potmeters control Servo pos
-        		led1=1; led2=1;
+        		redLed.write(1); greenLed.write(1); blueLed(0);
         		servoPos = pot2.read();
         		break;
         }
     }else{
-    	led1=0; led2=0;
+    	redLed.write(1); greenLed.write(1); blueLed(1);
     }
     motorSetSpeed2 = motorSetSpeed2 - 300*pot1.read();
    }
\ No newline at end of file