Created
February 20, 2019 10:25
-
-
Save amrithmmh/b22c9dc4e8bd610e7158d8586133b602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import serial | |
ser = serial.Serial( port='/dev/ttyUSB0', baudrate=250000) | |
if ser.isOpen(): | |
ser.close() | |
ser.open() | |
ser.isOpen() | |
ser.write(("M114\r").encode()) | |
out = ''# let's wait one second before reading output (let's give device time to answer) | |
time.sleep(1) | |
while ser.inWaiting() > 0: | |
out += str(ser.read(40)) | |
if out != '': | |
print(">>" + out) | |
ser.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi do you use this code to control 3D printer with Marlin firmware via USB connection using G codes and M codes?