yuvalmaimona
Newbie
I have a 3d Printer which i would like to connect.
the printer is Wanhao duplicator i3 plus, the project is converting it to 3 axis motorized stage.
the chip is from Atmega, and on google search i saw that its board is equivelent to Arduino mega 2560.
According to the datasheet of tre printer it uses Repteir.
i tried the following python code:
The software manages to open the connection to the printer, however i can't get the rest of the code to work.
thanks for your help!
the printer is Wanhao duplicator i3 plus, the project is converting it to 3 axis motorized stage.
the chip is from Atmega, and on google search i saw that its board is equivelent to Arduino mega 2560.
According to the datasheet of tre printer it uses Repteir.
i tried the following python code:
Python:
threeDPrinterData = serial.Serial('com5',115200)
print('please wait, the device will reset in a few seconds')
def query(msg):
msg=(msg+'\r\n').encode()
threeDPrinterData.write(msg)
# we need to wait a little bit in order
# to receive the output
while threeDPrinterData.in_waiting == 0:
time.sleep(0.5)
response = ''
while threeDPrinterData.in_waiting > 0:
response += threeDPrinterData.readline().decode('utf-8')
#time.sleep(0.5)
return response
try:
time.sleep(15)
#Start Gcode
print (query('G21'))#metric values
print (query('G90'))#absolute positioning
print (query('M82'))#extruder absolute positioning
print (query('G28 X0 Y0'))#;move X/Y to min endstops
print (query('G28 Z0'))#;move Z to min endstops
print (query('G92 E0'))#zero the extruded length
time.sleep(15)
#Main Gcode
ee360=32.1
zz=50
while (zz<=50):
print (query('G1 Z'+str(zz)+' F2400'))#move to 0.5mm in Z zxis with 2400 mm/min
time.sleep(5)
print (query('G1 X0 F2400'))
ee=0
x=0
while (ee<360):
deg=(ee360/360)*ee
print (query('G1 F240 E'+str(deg)))#metric values
time.sleep(7)
time.sleep(1)
print (query('G1 X200 F2400'))#move to 200mm in x zxis with 2400 mm/min
time.sleep(4.5)
time.sleep(3)
print (query('G1 X0 F2400'))#move to 0mm in x zxis with 2400 mm/min
time.sleep(3)
x=x+1
ee=ee+1
zz=zz+5
finally:
#End Gcode
time.sleep(1)
print (query('G28 X0 Y0'))#;move X/Y to min endstops
print (query('G28 Z0'))#;move Z to min endstops
print (query('M84'))#;steppers off
threeDPrinterData.close()
The software manages to open the connection to the printer, however i can't get the rest of the code to work.
thanks for your help!
Last edited by a moderator: