简体   繁体   English

在python openWRT arduino中

[英]While in python openWRT arduino

I'm writing a python program in openWRT for arduino (dragino + mega adk), first my code is OK in linux console, but when I use it in Arduino, with runShellCommand, it didn't work. 我正在用openWRT为arduino(dragino + mega adk)写一个python程序,首先我的代码在linux控制台中是可以的,但是当我在Arduino中使用runShellCommand时,它没有用。 I realized the error is in the while loop(doing some tests), so please can you help me? 我意识到错误是在while循环中(进行了一些测试),所以请您能帮我吗? Where is the error? 错误在哪里?

It seems to be in brigde.py(to connect arduino with linux)..... but what can I do? 它似乎在brigde.py(将arduino与linux连接).....但是我该怎么办?

some of the code... 一些代码...

while fr==0:

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

I kill the process using the PID, to get out the while loop.... 我使用PID终止进程,以退出while循环。

Solved! 解决了! I think some goes wrong with the bridge, so I disabled it to make a CLEAN serial connection between arduino(ath0) and dragino module (both make an arduino yun), then I execute this python program at startup, adding this to the init files in /etc. 我认为网桥有些问题,因此我禁用了它,以在arduino(ath0)和dragino模块之间建立一个清晰的串行连接(都使arduino yun),然后在启动时执行此python程序,并将其添加到init文件中在/ etc中。 Is an easy way to use LUCI panel (dragino's visual interface) in System tab-->startup; 是在“系统”选项卡->“启动”中使用LUCI面板(dragino的可视界面)的简单方法; And in arduino I only do a serial connection at 9600bps, So It works fine at the moment. 而且在arduino中,我仅以9600bps进行串行连接,因此目前可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM