RPI.GPIO Help

hakugin.gin at gmail.com hakugin.gin at gmail.com
Fri Sep 11 15:00:55 EDT 2015


On Friday, September 11, 2015 at 2:25:15 PM UTC-4, John McKenzie wrote:
> Hello.
> 
>  Thanks to the help of people here and in other newsgroups I seem to have 
> something working doing the basics. (Buttons work, colours light up 
> appropriately.)

<snip>

> def red_button(channel):
>     global colour
>     if colour == 1:
>         pass
>     elif colour == 2 or 3:
>         colour = 1
>         while colour == 1:
>             led.pulse(red=255, green=0, blue=0, repeats=1, duration=2000, 
> steps=50)

<snip>

Another option for this would be:

def red_button(channel):
    global colour
    if colour != 1:
        colour = 1
    # Rest of your original code goes below here


I am currently checking some other options, unfortunately I am not at home or have access to a RPi right now so I am unable to fully test.




More information about the Python-list mailing list