#includeServo Xservo;Servo Yservo;Servo Zservo;int Xpitch=90;int Ypitch=90;int Zpitch=90;void setup(){ Xservo.attach(9); Yservo.attach(10); Zservo.attach(11); delay(100); Xservo.write(90); Yservo.write(90); Zservo.write(90); delay(1000);}void loop(){ int analogValueX=analogRead(0); int analogValueY=analogRead(1); int analogValueZ=analogRead(2); Xpitch=map(analogValueX,610,910,65,125 ); Xservo.write(Xpitch); Ypitch=map(analogValueY,510,700,20,160); Yservo.write(Ypitch); Zpitch=map(analogValueZ,750,865,20,160); Zservo.write(Zpitch); }
添加回答
举报
0/150
提交
取消