コード例 #1
0
ファイル: util.py プロジェクト: yychiang/xy
def draw(x, tolerance=0.05):
    if isinstance(x, drawing.Drawing):
        x = x.paths
    device = Device()
    time.sleep(2)
    device.pen_up()
    time.sleep(1)
    device.home()
    bar = progress.Bar()
    for path in bar(x):
        if tolerance:
            path = simplify(path, tolerance)
        device.draw(path)
コード例 #2
0
            print resp
            break


# Initialize x and y variables
x = 0
y = 0
delay = 1  # in seconds

# Connect and Initialize
print('Connecting...')
d = Device()
sleep(2)
print('Connected, returning home.')
d.pen_up()
d.home()
reportPos()

# Calibrate X
print('Calibrating X...')
moveX = True
try:
    while moveX:
        x = x + 5
        d.move(x, y)
        sleep(delay)
        reportPos()
except KeyboardInterrupt:
    moveX = False
    reportPos()
print('X Calibrated!')