πŸ–Š

From Noisebridge Wiki
Jump to navigation Jump to search

see also Axidraw & Ordi

AxiDraw v2 Guide

Python API

Command Line API

File:AxiDraw-pi-pen.png


Code[edit]

#python3
from pyaxidraw import axidraw   # import module                                
ad = axidraw.AxiDraw()          # Initialize class                             
ad.interactive()                # Enter interactive context                    
ad.connect()                    # Open serial port to AxiDraw                  
                                # Absolute moves follow:                       
ad.moveto(1,1)                  # Pen-up move to (1 inch, 1 inch)              
ad.lineto(2,1)                  # Pen-down move, to (2 inch, 1 inch)           
ad.moveto(0,0)                  # Pen-up move, back to origin.                 
ad.disconnect()                 # Close serial port to AxiDraw   

πŸ–Š

from time import sleep
def loop(d,s):
 ad.moveto(d,0)
 sleep(s)
 ad.moveto(0,0)
 sleep(s)

def loops(d,s,n):
 while n > 0:
  loop(d,s)
  n = n -1

loops(4,1,5)