Richard thanks,  

I followed your instructions and i get the button now, which is great, but 
once i press it nothing happens. It is suppose to turn on a led connected 
to GPIO22 but it doenst do it.  Any ideas?  i dont really have knowledge of 
web programming and maybe im just way out of my league but any advice on 
this will be greatly appreciate it.

Thanks

On Thursday, April 9, 2015 at 8:42:24 AM UTC-5, Richard wrote:
>
> In default/index.html view try something like this :
>
> <button onclick="ajax('btnon',[],null);">
>     {{=T('Name of your button')}}
> </button>
>
> Richard
>
> On Wed, Apr 8, 2015 at 8:39 PM, DXX <[email protected] <javascript:>> 
> wrote:
>
>> So im just starting with Python / Web2py .... i want to do a simple test 
>> page to have a button to turn on a led on a RPi...
>>
>> the default.py looks like this 
>>
>> import RPi.GPIO as GPIO
>>
>> def index():
>>     return dict(message="this is a test")
>>
>> def btnon():
>>     GPIO.setmode(GPIO.BCM)
>>     GPIO.setup(22, GPIO.OUT)
>>     GPIO.output(22,GPIO.HIGH)
>>
>>
>> What i would like to do is call that btnon on an event, like a click on 
>> something to make it exectute the commands.... if this something i can do 
>> on a simple way, if you can guide me, i will be greatly appreciated
>>
>>  -- 
>> 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] <javascript:>.
>> 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.

Reply via email to