#include<Servo.h>Servoarm;constintjoystickPin=A0;voidsetup(){arm.attach(9);arm.write(90);// Center position}voidloop(){intjoy=analogRead(joystickPin);// Push joystick right to waveif(joy>700){for(inti=0;i<3;i++){arm.write(45);delay(300);arm.write(135);delay(300);}arm.write(90);}}
Comments