diff --git a/README.md b/README.md index eae0b3efd363d9639db524f22ba2195914c73343..408e3058c93d40991ac9a5cfe30f9fcd9d5f3788 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,12 @@ I added 3 blue LEDs, to test they worked correctly I turned them all on using ba <br> -**Testing and implementing the code below it follows the spec you have provided. I've added a short video showcasing it in action!** - **Short demo:** [](http://www.youtube.com/watch?v=K9MPf20hbis) +**Testing and implementing the code below it follows the spec you have provided. I've added a short video showcasing it in action!** + *Final code:* ``` import RPi.GPIO as GPIO diff --git a/buttonTest.py b/buttonTest.py new file mode 100644 index 0000000000000000000000000000000000000000..ae5ef0d413ff8d2926177713a1670eb7a9e10223 --- /dev/null +++ b/buttonTest.py @@ -0,0 +1,15 @@ +import RPi.GPIO as GPIO +import time + +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) + +GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_UP) + +while True: + inputValue = GPIO.input(15) + if (inputValue == False): + print("Button pressed") + + # Sleep here to prevent button from beind held down + time.sleep(0.25) \ No newline at end of file