Select Git revision
gripper.py
gripper.py 676 B
"""Functions to manipulate gripper.
TODO: Integrate with FarmbotClient or FarmbotYoloClient
"""
from client import FarmbotClient
from creds import device_id
from creds import token
GRIPPER_PIN = 12
GRIPPER_OPEN_STATE = 0
GRIPPER_CLOSED_STATE = 1
def gripper_open():
"""Manipulate gripper by setting pin to 1."""
client = FarmbotClient(device_id, token)
client.write_pin(GRIPPER_PIN, GRIPPER_OPEN_STATE, pin_mode="digital")
client.shutdown()
def gripper_close():
"""Manipulate gripper by setting pin to 0."""
client = FarmbotClient(device_id, token)
client.write_pin(GRIPPER_PIN, GRIPPER_CLOSED_STATE, pin_mode="digital")
client.shutdown()