资源简介
基于arduino控制,写字机器人的控制代码及算法实现。。
代码片段和文件信息
#!/usr/bin/env python
“““\
Simple g-code streaming script for grbl
Provided as an illustration of the basic communication interface
for grbl. When grbl has finished parsing the g-code block it will
return an ‘ok‘ or ‘error‘ response. When the planner buffer is full
grbl will not send a response until the planner buffer clears space.
G02/03 arcs are special exceptions where they inject short line
segments directly into the planner. So there may not be a response
from grbl for the duration of the arc.
---------------------
The MIT License (MIT)
Copyright (c) 2012 Sungeun K. Jeon
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---------------------
“““
import serial
import time
# Open grbl serial port
s = serial.Serial(‘/dev/tty.usbmodem1811‘115200)
# Open g-code file
f = open(‘grbl.gcode‘‘r‘);
# Wake up grbl
s.write(“\r\n\r\n“)
time.sleep(2) # Wait for grbl to initialize
s.flushInput() # Flush startup text in serial input
# Stream g-code to grbl
for line in f:
l = line.strip() # Strip all EOL characters for consistency
print ‘Sending: ‘ + l
s.write(l + ‘\n‘) # Send g-code block to grbl
grbl_out = s.readline() # Wait for grbl response with carriage return
print ‘ : ‘ + grbl_out.strip()
# Wait here until grbl is finished to close serial port and file.
raw_input(“ Press to exit and disable grbl.“)
# Close file and serial port
f.close()
s.close()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-10-01 02:53 grbl-master\
文件 42 2015-10-01 02:53 grbl-master\.gitignore
文件 35285 2015-10-01 02:53 grbl-master\COPYING
文件 3496 2015-10-01 02:53 grbl-master\Makefile
文件 5702 2015-10-01 02:53 grbl-master\README.md
目录 0 2015-10-01 02:53 grbl-master\build\
文件 70 2015-10-01 02:53 grbl-master\build\.gitignore
目录 0 2015-10-01 02:53 grbl-master\doc\
目录 0 2015-10-01 02:53 grbl-master\doc\log\
文件 16560 2015-10-01 02:53 grbl-master\doc\log\commit_log_v0.7.txt
文件 26836 2015-10-01 02:53 grbl-master\doc\log\commit_log_v0.8c.txt
文件 70478 2015-10-01 02:53 grbl-master\doc\log\commit_log_v0.9g.txt
文件 24986 2015-10-01 02:53 grbl-master\doc\log\commit_log_v0.9i.txt
目录 0 2015-10-01 02:53 grbl-master\doc\media\
文件 60 2015-10-01 02:53 grbl-master\doc\media\COPYING
文件 10481 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo 150px.png
文件 42049 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo 250px.png
文件 58580 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo 320px.png
文件 48868 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo 640px.png
文件 4837 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo.pdf
文件 5687 2015-10-01 02:53 grbl-master\doc\media\Grbl Logo.svg
目录 0 2015-10-01 02:53 grbl-master\doc\sc
文件 2395 2015-10-01 02:53 grbl-master\doc\sc
文件 5679 2015-10-01 02:53 grbl-master\doc\sc
目录 0 2015-10-01 02:53 grbl-master\grbl\
文件 28327 2015-10-01 02:53 grbl-master\grbl\config.h
文件 1566 2015-10-01 02:53 grbl-master\grbl\coolant_control.c
文件 894 2015-10-01 02:53 grbl-master\grbl\coolant_control.h
文件 1681 2015-10-01 02:53 grbl-master\grbl\cpu_map.h
目录 0 2015-10-01 02:53 grbl-master\grbl\cpu_map\
文件 5574 2015-10-01 02:53 grbl-master\grbl\cpu_map\cpu_map_atmega2560.h
............此处省略49个文件信息
- 上一篇:分类器svm参考代码
- 下一篇:GPS 静态精度CEP值计算
评论
共有 条评论