
40 Make: Robotic Arms
if(btnOne == LOW){
posOne--;
delay(10);
}
if(btnTwo == LOW){
posOne++;
delay(10);
}
if(btnThree == LOW){
posTwo--;
delay(10);
}
if(btnFour == LOW){
posTwo++;
delay(10);
}
servoOne.write(posOne);
servoTwo.write(posTwo);
}
Much like our new circuit, the software we’re
writing to control our robotics projects is getting
longer, but we don’t have any new concepts in
this latest Arduino sketch. Above our void setup,
we have our servo library header file, our servo
variables, and our push-button variables. We also
establish two position variables that will help us
set the position of our two servos. Inside the void
setup, all we need to ...