【问题标题】:While in python openWRT arduino在 python openWRT arduino 中
【发布时间】:2015-05-17 01:38:20
【问题描述】:

我正在为 arduino (dragino + mega adk) 编写一个 python 程序,首先我的代码在 linux 控制台中是好的,但是当我在 Arduino 中使用它时,使用 runShellCommand,它没有工作。我意识到错误在while循环中(做一些测试),所以请你帮帮我吗?哪里出错了?

它似乎在 brigde.py 中(将 arduino 与 linux 连接).....但是我该怎么办?

一些代码...

while fr==0:

respuesta = some wsdl request
    try:
        codigo= respuesta.somethingIGet
        print codigo
    except:
        codigo = '0N0E'
        print codigo
    time.sleep(1) #pause 1 second

我使用 PID 终止进程,以退出 while 循环....

【问题讨论】:

  • 可能是缩进?我认为while循环的内容应该是缩进的。 (从respuesta = some wsdl request开始)

标签: python while-loop wsdl bridge arduino-yun


【解决方案1】:

解决了! 我认为网桥有些问题,所以我禁用它以在 arduino(ath0) 和 dragino 模块之间建立 CLEAN 串行连接(两者都是 arduino yun),然后我在启动时执行这个 python 程序,将它添加到 init 文件中在 / 等。是在系统选项卡-->启动中使用 LUCI 面板(dragino 的可视化界面)的简单方法;而在 arduino 中,我只以 9600bps 的速率进行串行连接,所以目前可以正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-28
    • 1970-01-01
    • 2016-06-30
    • 2015-03-08
    • 1970-01-01
    • 2021-03-14
    • 1970-01-01
    相关资源
    最近更新 更多