function Loop(){ if( !isNaN(elbowAngle)) { //!isNaN(shoulderAngle) && //shoulderServo.to(shoulderAngle); elbowServo.to(elbowAngle); //arduino.removeAllListeners('exit'); console.log("This is the elbow angle: "+ elbowAngle); } else { //arduino.removeAllListeners('exit'); console.log("Shoulder/Elbow NaN value detected."); } if( baseAngle <= 180) { baseServo.to(baseAngle); //arduino.removeAllListeners('exit'); console.log("Base angle moved to " + baseAngle); } if(clawAngle >= 0 && clawAngle <= 110) { //clawAngle = -clawAngle; console.log("This is the claw angle: " + clawAngle); clawServo.to(clawAngle); arduino.removeAllListeners('exit'); //console.log("This is the claw angle: "+ clawAngle ); } arduino.removeAllListeners('exit'); }