Advertisement
Guest User

Untitled

a guest
Apr 9th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. import smtplib
  3. import wiringpi2 as wiringpi
  4. from time import sleep # allows us a time delay
  5.  
  6. wiringpi.wiringPiSetupGpio()
  7. wiringpi.pinMode(18, 1) # sets GPIO 18 to output
  8. wiringpi.digitalWrite(18, 0) # sets port 18 to 0 (0V, off)
  9.  
  10. wiringpi.pinMode(22, 0) # sets GPIO 22 to input
  11.  
  12. try:
  13. while True:
  14. if wiringpi.digitalRead(22): # If button on GPIO22 pressed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement