Skip to content

Commit ec55f55

Browse files
Eric OngEric Ong
authored andcommitted
first commit
1 parent c2b567d commit ec55f55

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

basic_example.py

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

0 commit comments

Comments
 (0)