# Function to perform one step defstep(index): for pin, value in zip(pin_seq, step_seq[index]): GPIO.output(pin, value)
# Gmail IMAP server details USERNAME = '[email protected]'#replace with your email APP_PASSWORD = '000000'# replace with your app password MAIL_SERVER = 'imap.gmail.com' SENDER_EMAIL = '[email protected]'#replace with the email account you want to receive a notification from
# Initialize pygame mixer pygame.mixer.init()
# Load the sound file sound = pygame.mixer.Sound("sound.wav") #replace with the name of the audio file you want to play
defcheck_email(user, app_pwd, mail_server, sender): # connect to the server and go to its inbox mail = imaplib.IMAP4_SSL(mail_server) mail.login(user, app_pwd) mail.select('inbox')
# search for the mail from the given sender and mark as unseen result, data = mail.uid('search', None, '(FROM "{}" UNSEEN)'.format(sender)) mail_ids = data[0]
# if new mail, perform the stepper motor action if mail_ids: email_ids = mail_ids.split() latest_email_id = email_ids[-1] # mark the latest email as seen mail.uid('store', latest_email_id, '+FLAGS', '(\Seen)') # Play the sound sound.play() # Rotate motor 512 steps