Skip to content

Instantly share code, notes, and snippets.

@inderpreet
Last active November 24, 2021 02:16
Show Gist options
  • Save inderpreet/a552f03b61ebefbe135dea8fcbea568f to your computer and use it in GitHub Desktop.
Save inderpreet/a552f03b61ebefbe135dea8fcbea568f to your computer and use it in GitHub Desktop.
import RPi.GPIO as G
import time
G.setmode(G.BCM)
G.setwarnings(False)
G.setup(7, G.OUT)
G.setup(25, G.IN, pull_up_down=G.PUD_UP)
toggle = 1
data = 1
while( data == 1 ):
G.output(7, toggle)
toggle = not toggle
time.sleep(0.5) # makes the led blink at 1Hz
data = G.input(25)
G.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment