initilize GPIO in web2py-Scheduler

70 views
Skip to first unread message

Aydin S

unread,
May 22, 2015, 11:36:59 AM5/22/15
to web...@googlegroups.com
I'm trying to set a pin to high (for instance) in a periodic way using web2py in an embedded linux.
I set the GPIO to output for example :
GPIO.setup(pin 20, output)
and then
if x>y
GPIO.setup(pin 20, high)

and run the scheduler every 10 second
The problem with this is that every 10 second when it gets to the line which sets the pin to be output, it turns it low (that's the default).

I am frustrated with scheduler to get it to run two functions so that I can put the pin initialization in one which runs only at startup. I tried to use the crontab -e and initialize there, but it looks like web2py models does not have access to those and failed to run.

I've been thinking to make a creative way to bypass GPIO setup after first run of scheduler and I was successful but scheduler fails in the second repeat because does not know the setup apparently.

Web2py experts please help me find out the solution....Thanks
 

Niphlod

unread,
May 22, 2015, 2:55:49 PM5/22/15
to web...@googlegroups.com
every scheduler task is executed within an isolated process. I don't know the internals of GPIO but I guess you'd need either:
- istantiate gpio, retrieve the value, act upon it (e.g. setting a new value)
- set two tasks: one (the 1st) that either is repetitive but stores somewhere if it ran correctly or that doesn't repeat itself, and the other one to repeat (2nd to nth)

António Ramos

unread,
May 23, 2015, 9:02:34 AM5/23/15
to web...@googlegroups.com
Why do people use raspbery pi ?

I use electric imp or even esp8266 and have my sensors connected to the cloud where the app lives.

No more problems with setting up linux, drivers, etc

Its IOT time!!



--
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave S

unread,
May 26, 2015, 1:46:25 PM5/26/15
to web...@googlegroups.com


On Saturday, May 23, 2015 at 6:02:34 AM UTC-7, Ramos wrote:
Why do people use raspbery pi ?

I use electric imp or even esp8266 and have my sensors connected to the cloud where the app lives.

No more problems with setting up linux, drivers, etc

Its IOT time!!


a) First I've heard of electric imp or esp8266
b) Raspberry Pi isn't just a sensor platform (that wasn't even what it was developed for).

/dps
 
Reply all
Reply to author
Forward
0 new messages