3D Drucker Quadrate

from time import sleep
import RPi.GPIO as GPIO

# Einstellen, dass die GPIO-Zuweisung so ist wie auf dem Bord
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)

# Variablen erstellen
# Anschluesse auf dem Board

# x-Achse
A=12
B=16
C=18
D=22
# y-Achse
E=11
F=13
G=15
H=29
# z-Achse
I=35
J=36
K=37
L=38

# Pausenzeit
delay = 0.0055
# Umdrehungen
steps = 48
stift = 10
# Aussenschleife ( Anzahl der Quadrate )
loop = 4

# GPIO Pins vorbereiten
GPIO.setup(A,GPIO.OUT)
GPIO.setup(B,GPIO.OUT)
GPIO.setup(C,GPIO.OUT)
GPIO.setup(D,GPIO.OUT)
GPIO.setup(E,GPIO.OUT)
GPIO.setup(F,GPIO.OUT)
GPIO.setup(G,GPIO.OUT)
GPIO.setup(H,GPIO.OUT)
GPIO.setup(I,GPIO.OUT)
GPIO.setup(J,GPIO.OUT)
GPIO.setup(K,GPIO.OUT)
GPIO.setup(L,GPIO.OUT)
GPIO.output(A, False)
GPIO.output(B, False)
GPIO.output(C, False)
GPIO.output(D, False)
GPIO.output(E, False)
GPIO.output(F, False)
GPIO.output(G, False)
GPIO.output(H, False)
GPIO.output(I, False)
GPIO.output(J, False)
GPIO.output(K, False)
GPIO.output(L, False)

# Proceduren mit vier zu uebergebenden Werten
def setStepx(w1, w2, w3, w4):
GPIO.output(A, w1)
GPIO.output(B, w2)
GPIO.output(C, w3)
GPIO.output(D, w4)

def setStepy(w1, w2, w3, w4):
GPIO.output(E, w1)
GPIO.output(F, w2)
GPIO.output(G, w3)
GPIO.output(H, w4)

def setStepz(w1, w2, w3, w4):
GPIO.output(I, w1)
GPIO.output(J, w2)
GPIO.output(K, w3)
GPIO.output(L, w4)

# Aeussere Schleife (Anzahl der Quadtrate )

for x in range(0, loop):

# stift senken

for i in range(0, stift):
setStepz(0,1,0,0)
sleep(delay)
setStepz(0,1,0,1)
sleep(delay)
setStepz(0,0,0,1)
sleep(delay)
setStepz(1,0,0,1)
sleep(delay)
setStepz(1,0,0,0)
sleep(delay)
setStepz(1,0,1,0)
sleep(delay)
setStepz(0,0,1,0)
sleep(delay)
setStepz(0,1,1,0)
sleep(delay)
print i

# X vorwaerts

for i in range(0, steps):
setStepx(0,1,1,0)
sleep(delay)
setStepx(0,0,1,0)
sleep(delay)
setStepx(1,0,1,0)
sleep(delay)
setStepx(1,0,0,0)
sleep(delay)
setStepx(1,0,0,1)
sleep(delay)
setStepx(0,0,0,1)
sleep(delay)
setStepx(0,1,0,1)
sleep(delay)
setStepx(0,1,0,0)
sleep(delay)
print i

# Y vorwaerts

for i in range(0, steps):
setStepy(0,1,1,0)
sleep(delay)
setStepy(0,0,1,0)
sleep(delay)
setStepy(1,0,1,0)
sleep(delay)
setStepy(1,0,0,0)
sleep(delay)
setStepy(1,0,0,1)
sleep(delay)
setStepy(0,0,0,1)
sleep(delay)
setStepy(0,1,0,1)
sleep(delay)
setStepy(0,1,0,0)
sleep(delay)
print i
# X rueckwaerts
for i in range(0, steps):
setStepx(0,1,0,0)
sleep(delay)
setStepx(0,1,0,1)
sleep(delay)
setStepx(0,0,0,1)
sleep(delay)
setStepx(1,0,0,1)
sleep(delay)
setStepx(1,0,0,0)
sleep(delay)
setStepx(1,0,1,0)
sleep(delay)
setStepx(0,0,1,0)
sleep(delay)
setStepx(0,1,1,0)
sleep(delay)
print i

# Y rueckwaerts

for i in range(0, steps):
setStepy(0,1,0,0)
sleep(delay)
setStepy(0,1,0,1)
sleep(delay)
setStepy(0,0,0,1)
sleep(delay)
setStepy(1,0,0,1)
sleep(delay)
setStepy(1,0,0,0)
sleep(delay)
setStepy(1,0,1,0)
sleep(delay)
setStepy(0,0,1,0)
sleep(delay)
setStepy(0,1,1,0)
sleep(delay)
print i

# Stift heben
for i in range(0, stift):
setStepz(0,1,1,0)
sleep(delay)
setStepz(0,0,1,0)
sleep(delay)
setStepz(1,0,1,0)
sleep(delay)
setStepz(1,0,0,0)
sleep(delay)
setStepz(1,0,0,1)
sleep(delay)
setStepz(0,0,0,1)
sleep(delay)
setStepz(0,1,0,1)
print i

# 4 vor X
for i in range(0, 4):
setStepx(0,1,1,0)
sleep(delay)
setStepx(0,0,1,0)
sleep(delay)
setStepx(1,0,1,0)
sleep(delay)
setStepx(1,0,0,0)
sleep(delay)
setStepx(1,0,0,1)
sleep(delay)
setStepx(0,0,0,1)
sleep(delay)
setStepx(0,1,0,1)
sleep(delay)
setStepx(0,1,0,0)
sleep(delay)
print i

# 4 vor Y
for i in range(0, 4):
setStepy(0,1,1,0)
sleep(delay)
setStepy(0,0,1,0)
sleep(delay)
setStepy(1,0,1,0)
sleep(delay)
setStepy(1,0,0,0)
sleep(delay)
setStepy(1,0,0,1)
sleep(delay)
setStepy(0,0,0,1)
sleep(delay)
setStepy(0,1,0,1)
sleep(delay)
setStepy(0,1,0,0)
sleep(delay)
print i

# Quadrat um 8 Umdrehungen verkleinern
steps = steps-8

# GPIO Pins aufraeumen
GPIO.cleanup()

3D Drucker Motortest.py

from time import sleep
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
# Anschluesse auf dem Board

A=12
B=16
C=18
D=22

# Variablen erstellen

# Pausenzeit
delay = 0.0055
# Umdrehungen
steps = 70
# Aussenschleife
loop = 4

# GPIO Pins vorbereiten
GPIO.setup(A,GPIO.OUT)
GPIO.setup(B,GPIO.OUT)
GPIO.setup(C,GPIO.OUT)
GPIO.setup(D,GPIO.OUT)
GPIO.output(A, False)
GPIO.output(B, False)
GPIO.output(C, False)
GPIO.output(D, False)

# Procedur mit vier zu uebergebenden Werten
def setStep(w1, w2, w3, w4):
GPIO.output(A, w1)
GPIO.output(B, w2)
GPIO.output(C, w3)
GPIO.output(D, w4)

# Aeussere Schleife

for x in range(0, loop):

# Innere Schleife vorwaerts

for i in range(0, steps):
setStep(1,0,1,0)
sleep(delay)
setStep(0,1,1,0)
sleep(delay)
setStep(0,1,0,1)
sleep(delay)
setStep(1,0,0,1)
sleep(delay)
print i

# Innere Schleife rueckwaerts

for i in range(0, steps):
setStep(1,0,0,1)
sleep(delay)
setStep(0,1,0,1)
sleep(delay)
setStep(0,1,1,0)
sleep(delay)
setStep(1,0,1,0)
sleep(delay)
print i

# GPIO Pins aufraeumen
GPIO.cleanup()

Button an
Teilen auf Facebook
Teilen auf Twitter
Teilen auf LinkedIn
Mein YouTube Kanal
Link per Mail versenden
Button aus

Durch die weitere Nutzung von www.easydatenbank.de stimmst du der Verwendung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen" eingestellt, um das beste Surferlebnis zu ermöglichen. Wenn du diese Website ohne Änderung der Cookie-Einstellungen verwendest oder auf "Akzeptieren" klickst, erklärst du sich damit einverstanden.

Schließen