-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic_example.py
46 lines (34 loc) · 1.1 KB
/
basic_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# uArm Swift Pro - Python Library Example
# Created by: Richard Garsthagen - [email protected]
# V0.1 - June 2017 - Still under development
import uArmRobot
import time
#Configure Serial Port
#serialport = "com3" # for windows
#serialport = "/dev/ttyACM0" # for linux like system
serialport = "dev/cu.usbmod" # for linux like system
# Connect to uArm
myRobot = uArmRobot.robot(serialport)
myRobot.debug = False # Enable / Disable debug output on screen, by default disabled
myRobot.connect()
myRobot.mode(0) # Set mode to Normal
time.sleep(1)
# Move robot, command will complete when motion is completed
myRobot.goto(200,0,100,6000)
# Turn on the pump
myRobot.pump(True)
# Send move command, but continue program
myRobot.async_goto(200,150,250,3000)
while myRobot.moving:
print ("Waiting to complete move")
time.sleep(0.5)
#Turn off the pump
myRobot.pump(False)
# Send move command, but continue program
myRobot.async_goto(200,0,100,6000)
while myRobot.moving:
print ("Waiting to complete move")
time.sleep(0.5)
time.sleep(5)
#Disconnect serial connection
myRobot.disconnect()