User Tools

Site Tools


gpio_inputs_-_button_led_control_using_an_interrupt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
gpio_inputs_-_button_led_control_using_an_interrupt [2016/08/09 23:00] walkeradmingpio_inputs_-_button_led_control_using_an_interrupt [2016/08/09 23:04] walkeradmin
Line 2: Line 2:
 \\  \\ 
 \\  \\ 
-blah blah+The previous example of using a button to light an LED, everything worked fine, but our processor was at 100%, this needs fixing, so in this example instead of constantly polling and setting GPIO pins, we are using a interrupt where by we do nothing until a button is actually pressed.
 \\  \\ 
 +Create a new file in the normal way ( you can download the python file {{ :led-button-i.zip |here}} to save time)
 \\  \\ 
     #import modules     #import modules
-    import RPi.GPIO as GPIO    # This imports the GPIO libarary that allows the use of the GPIO pins, +    import RPi.GPIO as GPIO    # This imports the GPIO library that allows the use of the GPIO pins, 
-    import time                # This imports the time libarary (for delays among other things)+    import time                # This imports the time library (for delays among other things)
                                # These libraries are built in to Raspbian.                                # These libraries are built in to Raspbian.