Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO, feedparser, time, os.path
- USERNAME = "" # gamil username
- PASSWORD = "" # gamil password
- GPIO.setmode(GPIO.BOARD)
- pin2 = 12
- GPIO.setup(pin2, GPIO.OUT)
- pwm=GPIO.PWM(pin2, 500)
- pwm.start(0)
- while True:
- found=False
- cur_mails = feedparser.parse("https://" + USERNAME + ":" + PASSWORD +"@mail.google.com/gmail/feed/atom")
- total = int(cur_mails["feed"]["fullcount"])
- if total > 0:
- for i in range(0,total):
- if cur_mails["entries"][i]["author_detail"]["email"] == "support@thepihut.com":
- found=True
- if found:
- pwm.ChangeDutyCycle(50)
- else:
- pwm.ChangeDutyCycle(0)
- time.sleep(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement