Oliver: I use to do what you need to communicate with Arduino in different projects. I think it's better if you get rid of the scheduler: you may loose data if the serial port buffer is full while the scheduler is not working. What I use is:
- write a script in an infinite loop like any usual pyserial script that reads from the serial port. The script must have a function that will begin the communication with the serial port after being open, def main() could be fine. - Put the script in the controllers directory of your web application, and use dal instructions to put the data in the database you prefer when receiving it from arduino. Sqlite is nice if the project won't have too many concurrent users. - Run the script from the web2py directory using: python web2py.py -M -S application_name/script_name/function_name, example web2py.py -M -S scada/arduino/main - As you use in the script the same model from your application you can use all the data you have received in the db This method is pretty easy and transparent. Regards José L. 2016-02-09 8:25 GMT+01:00 Oliver Holmes <[email protected]>: > Thanks to you both. I should clear up a slight misunderstanding. I have > written the part, where the serial port is read (using pyserial). I am now > trying to figure out, how to connect this to web2py, so that it can serve > the data nicely. It was my understanding, Massimo, that the scheduler was > supposed to provide a way to not block the webservice with potentially > blocking tasks - hence my question. My idea was to fill the SQLite tables I > created in the web2py model with that scheduled task. Now you have > discouraged me a bit. Could you please elaborate a bit on how you feel I > should go about this task? > > And thanks, Marcelo, about an hour after my post, I realized that I could > just download the latest source and use that... I am a little slow ;) > > Regards, > Oliver > > Am Montag, 8. Februar 2016 10:23:54 UTC+1 schrieb Oliver Holmes: >> >> Hi, >> >> I'm new to web2py and quite frankly to python as well, so please bear >> with me ;) >> I would like to use web2py to serve data, that it has gathered and >> processed from the serial port. There is new data available once a second. >> Obviously I'll have to use the scheduler, to accomplish reading and >> processing the serial port repeatedly. My question is this: How would I go >> about setting up that worker task in the scheduler? And by the way, since >> I'll be doing this on a RaspberryPi, how can I get a newer version than >> "Version 1.99.7 (2012-03-04 22:12:08)" apt-get will not deliver anything >> newer for my Raspian... >> >> Regards, >> Oliver >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

