Skip to content
Snippets Groups Projects
Select Git revision
  • 511635ea709d374f554fd650e82538fb536b67f4
  • master default protected
  • state_at_demo_220614
3 results

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()