#include <Servo.h>
Servo arm;
float pos = 0.0;
float step = 1.0;
void setup() {
pinMode(13, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
arm.attach(2);
arm.write(pos);
}
void loop() {
if (!digitalRead(13))
{
if (pos>0)
{
arm.write(pos);
pos-=step;
}
}
if (!digitalRead(1))
{
if (pos<180)
{
arm.write(pos);
pos+=step;
}
}
}