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