This may be a bit of a long shot but I can't figure out the problem here. I'm trying to build an interface on my laptop using tkinter and pySerial to control my 3D-printer. I've got a function that contains this piece of code (Yes, I imported time and serial):
ser = serial.Serial('COM3', 115200)
time.sleep(2)
ser.write(str.encode("G28
"))
time.sleep(1)
ser.close()
This sends the gcode "G28" to the 8bit mainboard of my 3d printer (Ender3), which makes it home.
This is very hit and miss however. One time it works, the other it doens't. When it doesn't, it seems to reset/restart the printer. Anyone have a clue what could cause this?
question from:
https://stackoverflow.com/questions/65904566/using-pyserial-to-send-gcode 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…