diff --git a/GPIO/RPi.GPIO/ring.RPi.GPIO.py b/GPIO/RPi.GPIO/ring.RPi.GPIO.py new file mode 100644 index 0000000000000000000000000000000000000000..e4199e9b1916ba0d6885e1a01520118f71ba2cf6 --- /dev/null +++ b/GPIO/RPi.GPIO/ring.RPi.GPIO.py @@ -0,0 +1,24 @@ +# +# ring.RPi.GPIO.py +# Raspberry Pi RPI.GPIO ring oscillator test +# +# Neil Gershenfeld 3/21/21 +# +# This work may be reproduced, modified, distributed, +# performed, and displayed for any purpose, but must +# acknowledge this project. Copyright is retained and +# must be preserved. The work is provided as is; no +# warranty is provided, and users accept all liability. +# +import RPi.GPIO as GPIO +pinout = 16 +pinin = 18 +GPIO.setwarnings(False) +GPIO.setmode(GPIO.BOARD) +GPIO.setup(pinout,GPIO.OUT) +GPIO.setup(pinin,GPIO.IN) +while (True): + if (GPIO.input(pinin) == GPIO.LOW): + GPIO.output(pinout,GPIO.HIGH) + else: + GPIO.output(pinout,GPIO.LOW) diff --git a/GPIO/gpiozero/ring.gpiozero.py b/GPIO/gpiozero/ring.gpiozero.py new file mode 100644 index 0000000000000000000000000000000000000000..30316c1dcabb651c0f9274b7e860ab40ca46108c --- /dev/null +++ b/GPIO/gpiozero/ring.gpiozero.py @@ -0,0 +1,21 @@ +# +# ring.gpiozero.py +# Raspberry Pi gpiozero ring oscillator test +# +# Neil Gershenfeld 3/21/21 +# +# This work may be reproduced, modified, distributed, +# performed, and displayed for any purpose, but must +# acknowledge this project. Copyright is retained and +# must be preserved. The work is provided as is; no +# warranty is provided, and users accept all liability. +# +from gpiozero import LED +from gpiozero import Button +led = LED(23) +button = Button(24) +while (True): + if button.is_pressed: + led.on() + else: + led.off()