LiquidCrystal_I2C lcd(0x27,16,2); Servo T; Servo J; Servo I; Servo M; Servo R; Servo P; void setup() { lcd.init(); lcd.clear(); lcd.backlight(); T.attach(3); I.attach(5); R.attach(6); M.attach(9); P.attach(10); J.attach(11); } void loop() { int pot1=map(analogRead(A0), 0, 1023, 0, 180); int pot2=map(analogRead(A1), 0, 1023, 0, 600); if (pot2 >=0 && pot2 <100){ if(pot1>=90 && pot1<=100){ lcd.clear(); J.write(90); lcd.setCursor(2,0); lcd.print("Joint htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Joint "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); J.write(pot1); delay(30); } } if (pot2 >=100 && pot2 <200){ if(pot1>=90 && pot1<=100){ lcd.clear(); T.write(T); //change HERE lcd.setCursor(2,0); lcd.print("Thumb htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Thumb "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); T.write(pot1); delay(30); } } if (pot2 >=200 && pot2 <300){ if(pot1>=90 && pot1<=100){ lcd.clear(); I.write(I); //change HERE lcd.setCursor(2,0); lcd.print("Index htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Index "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); I.write(pot1); delay(30); } } if (pot2 >=300 && pot2 <400){ if(pot1>=90 && pot1<=100){ lcd.clear(); M.write(M); //change HERE lcd.setCursor(2,0); lcd.print("Middle htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Middle "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); M.write(pot1); delay(30); } } if (pot2 >=400 && pot2 <500){ if(pot1>=90 && pot1<=100){ lcd.clear(); R.write(R); //change HERE lcd.setCursor(2,0); lcd.print("Ring htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Ring "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); R.write(pot1); delay(30); } } if (pot2 >=500 && pot2 <600){ if(pot1>=90 && pot1<=100){ lcd.clear(); P.write(P); //change HERE lcd.setCursor(2,0); lcd.print("Pinky htl"); lcd.setCursor(2,1); lcd.print("Rotation :"); lcd.print(pot1); } else{ lcd.clear(); lcd.setCursor(2,0); lcd.print("Pinky "); lcd.print(pot2); lcd.setCursor(2, 1); lcd.print("Rotation :"); lcd.print(pot1); P.write(pot1); delay(30); } } }