Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- GPIO.setmode(GPIO.BOARD)
- GPIO.setup(7, GPIO.IN)
- # loop through 50 times, on/off for 1 second
- for i in range(500):
- if GPIO.input(7):
- print("Listening")
- i = i + 10
- time.sleep(1)
- print()
- else:
- print("No Sound")
- time.sleep(.01)
- i = i + 1
- GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement