예제 #1
0
################################################################################################
#################                            ###################################################
#################    Parameters set up       ###################################################
#################                            ###################################################
################################################################################################
################################################################################################

filename = 'Tsinghua_symbol.nc'  # file name of the G code commands

if len(sys.argv) > 1:
    filename = str(sys.argv[1])

GPIO.setmode(GPIO.BOARD)

# pin number for a1,a2,b1,b2.  a1 and a2 form coil A b1 and b2 form coil B
MX = Bipolar_Stepper_Motor(11, 12, 15, 13, 'X')

MY = Bipolar_Stepper_Motor(16, 18, 37, 36, 'Y')

Pen_switch = 32

dx = 0.075  # resolution in x direction. Unit: mm
dy = 0.075  # resolution in y direction. Unit: mm
IsPenDown = 2  # 0 - false, 1 - true 2 - unknown

#######B#########################################################################################
################################################################################################
#################                            ###################################################
#################    Other initialization    ###################################################
#################                            ###################################################
################################################################################################
예제 #2
0
파일: gcode.py 프로젝트: getarun/raspberry
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

################################################################################################
################################################################################################
#################                            ###################################################
#################    Parameters set up       ###################################################
#################                            ###################################################
################################################################################################
################################################################################################

filename='Xiang.nc'; #file name of the G code commands

GPIO.setmode(GPIO.BOARD)

MX=Bipolar_Stepper_Motor(23,22,24,26);     #pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY=Bipolar_Stepper_Motor(11,7,5,3);       

Laser_switch=15;

dx=0.075; #resolution in x direction. Unit: mm
dy=0.075; #resolution in y direction. Unit: mm

Engraving_speed=0.1; #unit=mm/sec=0.04in/sec

#######B#########################################################################################
################################################################################################
#################                            ###################################################
#################    Other initialization    ###################################################
#################                            ###################################################
예제 #3
0
import RPi.GPIO as GPIO
import Motor_control
from Bipolar_Stepper_Motor_Class import Bipolar_Stepper_Motor
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

#################    Parameters set up       ###################################################


filename='ninjapower.nc'; #file name of the G code commands

GPIO.setmode(GPIO.BOARD)

MX=Bipolar_Stepper_Motor(7,22,18,16);     #pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY=Bipolar_Stepper_Motor(15,13,12,11);       

Laser_switch=5;

dx=0.075; #resolution in x direction. Unit: mm
dy=0.075; #resolution in y direction. Unit: mm

Engraving_speed=0.6; #unit=mm/sec=0.04in/sec


#################    Other initialization    ###################################################

GPIO.setup(Laser_switch,GPIO.OUT);

GPIO.output(Laser_switch,True);
예제 #4
0
from numpy import pi, sin, cos, sqrt, arccos, arcsin

################################################################################################
################################################################################################
#################                            ###################################################
#################    Parameters set up       ###################################################
#################                            ###################################################
################################################################################################
################################################################################################

filename = 'trebel.nc'
#file name of the G code commands

GPIO.setmode(GPIO.BCM)

MX = Bipolar_Stepper_Motor(17, 4)
#pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY = Bipolar_Stepper_Motor(23, 22)

Laser_switch = 24

dx = 0.15
#resolution in x direction. Unit: mm
dy = 0.15
#resolution in y direction. Unit: mm

Engraving_speed = 35
#=0.1; #unit=mm/sec=0.04in/sec

#######B#########################################################################################
예제 #5
0
#							  				       #
#     linear motion                                                                #
#       Xiang Zhai,   May 2, 2013                         				       #
#       zxzhaixiang at gmail.com							       #
#  For instruction on how to build the laser engraver and operate the codes, please visit      #
#   funofdiy.blogspot.com                                                                      #
#											       #
################################################################################################

import RPi.GPIO as GPIO
from Bipolar_Stepper_Motor_Class import Bipolar_Stepper_Motor
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

GPIO.setmode(GPIO.BOARD)
M = Bipolar_Stepper_Motor(11, 7, 5, 3)

speed = 200
#step/sec

try:
    for i in range(30):
        print "Move to %s .." % ((i + 1) * 1000)
        M.move(-1, 1000, 1.0 / speed)

except KeyboardInterrupt:
    pass

M.unhold()

GPIO.cleanup()
import RPi.GPIO as GPIO
import Motor_control
from Bipolar_Stepper_Motor_Class import Bipolar_Stepper_Motor
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

################################################################################################
################################################################################################
#################                            ###################################################
#################    Parameters set up       ###################################################
#################                            ###################################################
################################################################################################
################################################################################################
GPIO.setmode(GPIO.BCM)

MX = Bipolar_Stepper_Motor(10, 9, 11, 25)
#pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY = Bipolar_Stepper_Motor(17, 22, 18, 4)
stilo = 12
dx = 0.15
#resolution in x direction. Unit: mm
dy = 0.15
#resolution in y direction. Unit: mm
write_speed = 10
#unit=mm/sec=0.04in/sec
filename = '/home/pi/Desktop/cnc/gcode.ngc'

#######B#########################################################################################
################################################################################################
#################                            ###################################################
예제 #7
0
#	Ian D. Miller
#	Jan 7, 2014
#	http://www.pxlweavr.com
#	info [at] pxlweavr.com

print "Program Started"

import RPi.GPIO as GPIO
import Motor_control
from Bipolar_Stepper_Motor_Class import Bipolar_Stepper_Motor
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

#Test program for stepper motor

GPIO.setmode(GPIO.BOARD)
GPIO.setup(3,GPIO.OUT)

motor=Bipolar_Stepper_Motor(8,10,12,16)

try:
    while True:
        direction = int(raw_input("Input Direction: "))
        steps = int(raw_input("Input Step Number: "))
        laservar = int(raw_input("Laser state: "))
        GPIO.output(3,laservar)
        motor.move(direction,steps,0.01)

except KeyboardInterrupt:
    GPIO.cleanup()
예제 #8
0
#	Ian D. Miller
#	Jan 7, 2014
#	http://www.pxlweavr.com
#	info [at] pxlweavr.com

print "Program Started"

import RPi.GPIO as GPIO
import Motor_control
from Bipolar_Stepper_Motor_Class import Bipolar_Stepper_Motor
import time
from numpy import pi, sin, cos, sqrt, arccos, arcsin

#Test program for stepper motor

GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT)

motor = Bipolar_Stepper_Motor(8, 10, 12, 16)

try:
    while True:
        direction = int(raw_input("Input Direction: "))
        steps = int(raw_input("Input Step Number: "))
        laservar = int(raw_input("Laser state: "))
        GPIO.output(3, laservar)
        motor.move(direction, steps, 0.01)

except KeyboardInterrupt:
    GPIO.cleanup()
#ark = open('2017_0001.ngc', 'r')
#ark = open('squares_0001.ngc', 'r')
#ark = open('swirl_0001.ngc', 'r')
#ark = open('ovo_0001.ngc', 'r')
#ark = open('1234_0001.ngc', 'r')
#ark = open('losango_0001.ngc', 'r')
#ark = open('bigSwirl_0001.ngc', 'r')
#ark = open('wand_0001.ngc', 'r')
#ark = open('6squares_0001.ngc', 'r')
#ark = open('sozenarede_0001.ngc', 'r')

code = ark.read().split('\n')
ark.close()
speed = 0
max_precision = 0.075
motorX = Bipolar_Stepper_Motor(35, 36, 37, 38)
motorY = Bipolar_Stepper_Motor(11, 12, 13, 15)
servo_motor = Servo()
servo_motor.sweep()
# TODO:REMOVE THE sweep method call above


def getCoordinates(line):
    x_pos = float(line.split(' ')[1].upper().lstrip('X'))
    y_pos = float(line.split(' ')[2].upper().lstrip('Y').rstrip('\n'))
    return x_pos, y_pos


def getDirection(x_pos, y_pos):
    x = int(round(float(x_pos) / max_precision)) - motorX.position
    y = int(round(float(y_pos) / max_precision)) - motorY.position
예제 #10
0
#################                            ###################################################
################################################################################################
################################################################################################

parser = argparse.ArgumentParser(description="RPi Controlled Laser Engraver")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-f", "--filepath", help="Path to GCode file")
group.add_argument("-m", "--manual", action="store_true", help="Manually control printer")
parser.add_argument("-s", "--speed", type=float, help="Engraving speed (mm/sec)")
parser.add_argument("-t", "--title", help="Title of Engraving")

args = parser.parse_args()

GPIO.setmode(GPIO.BOARD)

MX=Bipolar_Stepper_Motor(22,18,24,26);     #pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY=Bipolar_Stepper_Motor(10,8,12,16);       

Laser_switch=3;

dx=0.075; #resolution in x direction. Unit: mm
dy=0.075; #resolution in y direction. Unit: mm

if (args.speed > 0):
	Engraving_speed=args.speed; #unit=mm/sec=0.04in/sec
else:
	Engraving_speed=0.1; #unit=mm/sec=0.04in/sec

#######B#########################################################################################
################################################################################################
예제 #11
0
from numpy import pi, sin, cos, sqrt, arccos, arcsin

################################################################################################
################################################################################################
#################                            ###################################################
#################    Parameters set up       ###################################################
#################                            ###################################################
################################################################################################
################################################################################################

#filename='caltech_symbol.nc'; #file name of the G code commands
filename = 'name_en.nc'

GPIO.setmode(GPIO.BOARD)

MX = Bipolar_Stepper_Motor(23, 22, 24, 26)
#pin number for a1,a2,b1,b2.  a1 and a2 form coil A; b1 and b2 form coil B

MY = Bipolar_Stepper_Motor(11, 7, 5, 3)

Laser_switch = 15

dx = 0.075
#resolution in x direction. Unit: mm
dy = 0.076
#resolution in y direction. Unit: mm

Engraving_speed = 0.4
#unit=mm/sec=0.04in/sec

#######B#########################################################################################