#include <Servo.h>
#include <AbleButtons.h>
using button = AblePullupDirectButton; button btn(2);
Servo claw;
void setup() {
// put your setup code here, to run once:
btn.begin();
claw.attach(3);
claw.write(90);
}
void loop() {
// put your main code here, to run repeatedly:
btn.handle();
claw_function();
}
void claw_function() { //180 = open, 90 = close
if (btn.isPressed()) {
claw.write(180);
}
else {
claw.write(90);
}
}