Next step is to combine the GPIO Input and Output in to one program.
With the power to the rPI off, I used another jumper to tie header pin 18 to the input of a high impedance logic probe.
import RPi.GPIO as GPIO
# to use Raspberry Pi board pin numbers
count = 1
while (count < 100):
input_value = GPIO.input(11)
Then I ran it with
$ sudo python switch_led.py
Now when the switch is turned on and off, the led goes on and off.
Congratulations, you now have a $35 programmable light switch. But once you can get digital data in and out of a program , the sky is the limit!
Eric Pierce VA3EP - See the Disclaimer in the Introduction
© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.