diff --git a/src/gripper.py b/src/gripper.py index d53b714fc353c24ca9f0435d3f0dc8262a09aa92..845315dac6a2704d41673397edf8bb01cf3dc524 100755 --- a/src/gripper.py +++ b/src/gripper.py @@ -1,11 +1,21 @@ -#!/usr/bin/env python3 -import serial +"""Functions to manipulate gripper. + +TODO: Integrate with FarmbotClient or FarmbotYoloClient +""" +from client import FarmbotClient +from creds import device_id +from creds import token + + def gripper_open(): - ser = serial.Serial('/dev/ttyUSB0') - ser.write(str.encode("o")) - ser.close + """Manipulate gripper by setting pin to 1.""" + client = FarmbotClient(device_id, token) + client.write_pin(1, 1, pin_mode="digital") + client.shutdown() + def gripper_close(): - ser = serial.Serial('/dev/ttyUSB0') - ser.write(str.encode("c")) - ser.close \ No newline at end of file + """Manipulate gripper by setting pin to 0.""" + client = FarmbotClient(device_id, token) + client.write_pin(1, 1, pin_mode="digital") + client.shutdown()