Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import time
  3. GPIO.setmode(GPIO.BOARD)
  4. GPIO.setup(7, GPIO.IN)
  5. # loop through 50 times, on/off for 1 second
  6. for i in range(500):
  7. if GPIO.input(7):
  8. print("Listening")
  9. i = i + 10
  10. time.sleep(1)
  11. print()
  12. else:
  13. print("No Sound")
  14. time.sleep(.01)
  15. i = i + 1
  16. GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement