Advertisement
Guest User

Untitled

a guest
Mar 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import RPi.GPIO as GPIO
  4. import time, smtplib
  5.  
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(25, GPIO.IN)
  8. GPIO.input(25)
  9. smtpserver = ''
  10. fromaddr = ''
  11. toaddr = ''
  12. msg = '1.2'
  13. #Aggiungo i dati per l'invio
  14. username = '' #inserire proprio indirizzo
  15. password = '' #inserire propria password
  16. while True:
  17. input_state = GPIO.input(25)
  18. if input_state == True:
  19. time.sleep(1)
  20. server = smtplib.SMTP(smtpserver)
  21. server.starttls()
  22. server.login(username, password)
  23. server.sendmail(fromaddr, toaddr, msg)
  24. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement