I'm writing a simple application to perform some data logging and I would like to have a python application running to receive the values.
I need this because I must decide if the data will be sent over a webservice or stored on a removable device so my approach was the following:
Start Bridge
Call the python script using Process something like this:
Process p;
p.begin("python");
p.addParameters("/mtn/sda/gpslog.py);
p.runAsynchronously();
later then I do something like this
char* buf = .... // I put something in the buffer
for(int i = 0; i< 20; i++)
{
p.write(buf*)* } p.write('\n'); On the python side I open a connection to ttyATH0 and keep listening for something and recording that to a file What is happening is that my python script never starts and no communications are done... I'm pretty sure that I have something very wrong here. Can someone point me to right direction????
Bridge library uses ttyATH0 to talk to the linux side. Thus, your python script cannot use that serial port at the same time. If you want to talk back (from linux to arduino) then your python script just has to print on stdout (suffices to use the "print" function)
I successfully use a plain Serial1 communication between my Arduino sketch and my python "/dev/ttyATH0" listener on OpenWrt-Yun. The incoming data from my sketch gets then broadcasted to my browser based clients using Tornado WebSockets.
BTW: I started using Tornado because when I started using Yun last year, there was no node.js support which I would habe highly appreciated.
I am having problems to receive data. Sometimes I lose characters and if I use pyserial I get exceptions like resource is not available and such things... I don't know why? Can someone post a sample?