def play_1_loop(press_time): dobot_state = dType.ConnectDobot(api, "", 115200)[0] if dobot_state == dType.DobotConnect.DobotConnect_NoError: moveForward() press_screen(press_time) time.sleep(1.7) moveForward(offset=-70) dType.DisconnectDobot(api) time.sleep(4)
import DobotDll.DobotDllType as dType import random from pynput import keyboard from pynput.keyboard import KeyCode CON_STR = { dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError", dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound", dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied" } #Load Dll api = dType.load() #Connect Dobot state = dType.ConnectDobot(api, "", 115200)[0] print("Connect status:", CON_STR[state]) if (state == dType.DobotConnect.DobotConnect_NoError): #Clean Command Queued dType.SetQueuedCmdClear(api) #Async Motion Params Setting dType.SetHOMEParams(api, 172, -120, 50, 0, isQueued=1) dType.SetPTPJointParams(api, 200, 200, 200, 200, 200,
def connect(): state = dType.ConnectDobot(api, "", 115200)[0] # Connect Dobot print("Connect status:", CON_STR[state]) return state
def main(): state = dType.ConnectDobot(api, "", 115200)[0] print("Connect status:", CON_STR[state]) if state == dType.DobotConnect.DobotConnect_NoError: work() dType.DisconnectDobot(api)