Gripper code for R5 bot
Dependents: GrabTest R5 2016 Robotics Team 1
Diff: Gripper.cpp
- Revision:
- 0:f1aeb307ab68
diff -r 000000000000 -r f1aeb307ab68 Gripper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gripper.cpp Wed Feb 24 16:31:12 2016 +0000 @@ -0,0 +1,17 @@ +#include "Gripper.h" + +Gripper::Gripper(PinName gripPin, PinName wristPin) : gripPwm(gripPin), wristPwm(wristPin) +{ + gripPwm.period_us(PWM_PER); + wristPwm.period_us(PWM_PER); + gripPwm.pulsewidth_us(GRIP_DEF); + wristPwm.pulsewidth_us(WRIST_DEF); +} + +void Gripper::grip() { gripPwm.pulsewidth_us(GRIP_CLOSE); } + +void Gripper::release() { gripPwm.pulsewidth_us(GRIP_OPEN); } + +void Gripper::lift() { wristPwm.pulsewidth_us(WRIST_UP); } + +void Gripper::lower() { wristPwm.pulsewidth_us(WRIST_DOWN); } \ No newline at end of file