Created
July 26, 2020 21:22
-
-
Save sficarro/679c9f4ee18ad5a174dc45dad9f9eb5c to your computer and use it in GitHub Desktop.
A python script that sends g-code to Arduino loaded with GRBL2 arduino
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 serial | |
import time | |
ser=serial.Serial('COM5', 9600) | |
counter = 0 | |
ser.write('g0x0\n') | |
time.sleep(1) | |
time.sleep(1) | |
while counter <50: | |
current = str(int(counter)) | |
print current | |
a = 'g0x' + current + '\n' | |
ser.write(a) | |
print a | |
time.sleep(2.5) | |
counter += 2.5 | |
time.sleep(2.5) | |
while counter >.2: | |
current = str(int(counter)) | |
print current | |
a = 'g0x' + current + '\n' | |
ser.write(a) | |
print a | |
time.sleep(2.5) | |
counter -= 2.5 | |
time.sleep(2.5) | |
time.sleep(2.5) | |
ser.write('g0x0\n') | |
time.sleep(5) | |
ser.write('g0x0\n') | |
time.sleep(1) | |
time.sleep(1) | |
while counter <50: | |
current = str(int(counter)) | |
print current | |
a = 'g0x' + current + '\n' | |
ser.write(a) | |
print a | |
time.sleep(2.5) | |
counter += 1 | |
time.sleep(2.5) | |
while counter >.2: | |
current = str(int(counter)) | |
print current | |
a = 'g0x' + current + '\n' | |
ser.write(a) | |
print a | |
time.sleep(2.5) | |
counter -= 1 | |
time.sleep(2.5) | |
time.sleep(2.5) | |
ser.write('g0x0\n') | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment