#include Servo myservo1;//BROWN Servo myservo2;//PURPLE Servo myservo3;//BLUE Servo myservo4;//ORANGE int inPin1 = 0;//CopperWire Switch int inPin2 = 1;//CopperWire Switch int inPin3 = 2;//CopperWire Switch int inPin4 = 3;//CopperWire Switch int val1 = 0;//variable for reading the pin status int val2 = 1;//variable for reading the pin status int val3 = 2;//variable for reading the pin status int val4 = 3;//variable for reading the pin status void setup() { myservo1.attach(9);//BROWN myservo1.write(60);//Servo Movement Check myservo2.attach(10);//PURPLE myservo2.write(60);//Servo Movement Check myservo3.attach(11);//BLUE myservo3.write(60);//Servo Movement Check myservo4.attach(12);//ORANGE myservo4.write(60);//Servo Movement Check pinMode(inPin1, INPUT); pinMode(inPin2, INPUT); pinMode(inPin3, INPUT); pinMode(inPin4, INPUT); //Serial.begin(9600); } void loop(){ val1 = analogRead(inPin1);//read input value val2 = analogRead(inPin2);//read input value val3 = analogRead(inPin3);//read input value val4 = analogRead(inPin4);//read input value //Serial.println(val1); //Serial.println(val2); //Serial.println(val3); //Serial.println(val4); if (val1 >= 1000) { myservo1.write(44);//open delay(10000);//delay for worm safety } else { myservo1.write(97);//close } if (val2 >= 1000) { myservo2.write(48);//open delay(10000);//delay for worm safety } else { myservo2.write(97);//close } if (val3 >= 1000) { myservo3.write(44);//open delay(10000);//delay for worm safety } else { myservo3.write(98);//close } if (val4 >= 1000) { myservo4.write(40);//open delay(10000);//delay for worm safety } else { myservo4.write(88);//close } delay(500); //delay for better readings }