Advertisement
Guest User

Untitled

a guest
Jan 31st, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1.  
  2. import RPi.GPIO as GPIO, feedparser, time, os.path
  3.  
  4. USERNAME = "" # gamil username
  5. PASSWORD = "" # gamil password
  6. GPIO.setmode(GPIO.BOARD)
  7. pin2 = 12
  8. GPIO.setup(pin2, GPIO.OUT)
  9. pwm=GPIO.PWM(pin2, 500)
  10. pwm.start(0)
  11.  
  12. while True:
  13.     found=False
  14.     cur_mails = feedparser.parse("https://" + USERNAME + ":" + PASSWORD +"@mail.google.com/gmail/feed/atom")
  15.     total = int(cur_mails["feed"]["fullcount"])
  16.     if total > 0:
  17.         for i in range(0,total):
  18.             if cur_mails["entries"][i]["author_detail"]["email"] == "support@thepihut.com":
  19.                 found=True
  20.     if found:
  21.         pwm.ChangeDutyCycle(50)
  22.     else:
  23.         pwm.ChangeDutyCycle(0)
  24.     time.sleep(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement