// PROGRAM : Flex-Sensor : Controlling 2 motors with 1st two fingers // Serial Monitor /* Remove commented part to check input from Serial Monitor for testing & Calibration (Ensure the other part of the code is commented out) int A=A1; void setup() { Serial.begin(9600); pinMode(A,INPUT); } void loop() { int s = analogRead(A); Serial.println(s); } */ int m1 = 8; int m2 = 9; int m3 = 10; int m4 = 11; int S1 = A0; int S2 = A1; void setup() { Serial.begin(9600); pinMode(m1,OUTPUT); pinMode(m2,OUTPUT); pinMode(m3,OUTPUT); pinMode(m4,OUTPUT); pinMode(S1,INPUT); pinMode(S2,INPUT); } void loop() { int s1 = analogRead(S1); int s2 = analogRead(S2); if(s1 > 270 && s1 < 390) { digitalWrite(m1,HIGH); digitalWrite(m2,LOW); } if(s1 > 170 && s1 < 250) { digitalWrite(m1,LOW); digitalWrite(m2,LOW); } if(s2 > 95 && s2 < 129) { digitalWrite(m3,HIGH); digitalWrite(m4,LOW); } if(s2 > 130 && s2 < 165) { digitalWrite(m3,LOW); digitalWrite(m4,LOW); } }