<small id='HTmJv'></small><noframes id='HTmJv'>

        <legend id='HTmJv'><style id='HTmJv'><dir id='HTmJv'><q id='HTmJv'></q></dir></style></legend>
        <i id='HTmJv'><tr id='HTmJv'><dt id='HTmJv'><q id='HTmJv'><span id='HTmJv'><b id='HTmJv'><form id='HTmJv'><ins id='HTmJv'></ins><ul id='HTmJv'></ul><sub id='HTmJv'></sub></form><legend id='HTmJv'></legend><bdo id='HTmJv'><pre id='HTmJv'><center id='HTmJv'></center></pre></bdo></b><th id='HTmJv'></th></span></q></dt></tr></i><div id='HTmJv'><tfoot id='HTmJv'></tfoot><dl id='HTmJv'><fieldset id='HTmJv'></fieldset></dl></div>
      1. <tfoot id='HTmJv'></tfoot>
          <bdo id='HTmJv'></bdo><ul id='HTmJv'></ul>
      2. PySerial App 在 shell 中运行,不是 py 脚本

        PySerial App runs in shell, by not py script(PySerial App 在 shell 中运行,不是 py 脚本)

          <tbody id='LVoLa'></tbody>

      3. <small id='LVoLa'></small><noframes id='LVoLa'>

            <legend id='LVoLa'><style id='LVoLa'><dir id='LVoLa'><q id='LVoLa'></q></dir></style></legend>
            • <bdo id='LVoLa'></bdo><ul id='LVoLa'></ul>
            • <i id='LVoLa'><tr id='LVoLa'><dt id='LVoLa'><q id='LVoLa'><span id='LVoLa'><b id='LVoLa'><form id='LVoLa'><ins id='LVoLa'></ins><ul id='LVoLa'></ul><sub id='LVoLa'></sub></form><legend id='LVoLa'></legend><bdo id='LVoLa'><pre id='LVoLa'><center id='LVoLa'></center></pre></bdo></b><th id='LVoLa'></th></span></q></dt></tr></i><div id='LVoLa'><tfoot id='LVoLa'></tfoot><dl id='LVoLa'><fieldset id='LVoLa'></fieldset></dl></div>

                <tfoot id='LVoLa'></tfoot>

                  本文介绍了PySerial App 在 shell 中运行,不是 py 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have a very simple python script that uses pySerial to send data over the serial port to my Arduino. When I execute this line-by-line in the python shell, it works just fine, but when I put it in a ".py" file, and try to run it, nothing happens. Though the serial lights on my UART do flash. So something is getting through, but it's garbage (I checked).

                  Here is the simple code.

                  import serial
                  
                  ser = serial.Serial('COM3',9600,timeout=.2)
                  ser.write('A')
                  ser.close()
                  

                  I've already tried adding sleeps, but nothing seems to be fixing it. Any ideas?

                  解决方案

                  OK, I've figured it out!

                  It's necessary to use code like this before performing the write:

                  time.sleep(1)
                  ser.setDTR(level=0)
                  time.sleep(1)
                  

                  Otherwise, the arduino automatically resets upon receiving a serial connection for some reason. yay!

                  这篇关于PySerial App 在 shell 中运行,不是 py 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pythonic and efficient way of finding adjacent cells in grid(在网格中查找相邻单元格的 Pythonic 和有效方法)
                  map a hexagonal grid in matplotlib(在 matplotlib 中映射六边形网格)
                  Execute arbitrary python code remotely - can it be done?(远程执行任意 python 代码 - 可以吗?)
                  Python - Plotting colored grid based on values(Python - 根据值绘制彩色网格)
                  Is there a GUI design app for the Tkinter / grid geometry?(是否有 Tkinter/网格几何图形的 GUI 设计应用程序?)
                  tkinter Canvas Scrollbar with Grid?(带有网格的 tkinter 画布滚动条?)
                    <tfoot id='MIdfu'></tfoot>
                      <bdo id='MIdfu'></bdo><ul id='MIdfu'></ul>
                          <tbody id='MIdfu'></tbody>

                        • <i id='MIdfu'><tr id='MIdfu'><dt id='MIdfu'><q id='MIdfu'><span id='MIdfu'><b id='MIdfu'><form id='MIdfu'><ins id='MIdfu'></ins><ul id='MIdfu'></ul><sub id='MIdfu'></sub></form><legend id='MIdfu'></legend><bdo id='MIdfu'><pre id='MIdfu'><center id='MIdfu'></center></pre></bdo></b><th id='MIdfu'></th></span></q></dt></tr></i><div id='MIdfu'><tfoot id='MIdfu'></tfoot><dl id='MIdfu'><fieldset id='MIdfu'></fieldset></dl></div>
                          <legend id='MIdfu'><style id='MIdfu'><dir id='MIdfu'><q id='MIdfu'></q></dir></style></legend>

                            <small id='MIdfu'></small><noframes id='MIdfu'>