def thirteen(self, speaker_action): logger_output(self.logger, 'info', 'sending number 13') if speaker_action == 'on': logger_output(self.logger, 'info', 'turning speaker on') self.gpio.setup(13, self.gpio.OUT) self.gpio.output(13, self.gpio.HIGH) elif speaker_action == 'off': logger_output(self.logger, 'info', 'turning speaker off') self.gpio.setup(13, self.gpio.IN)
def execute(self): """Processes the messages from the queue""" self.queue_url = self.resolve_queue_url() try: while True: messages = self.get_queue_messages(self.queue_url) # there were no messages returned if 'Messages' in messages: # loop through all the messages received for message in messages['Messages']: self.handle_message(json.loads(message.get('Body')), message.get('ReceiptHandle')) # It is June 24, 2017 08:06:35AM right_now = datetime.now().strftime('It is %B %d, %Y %I:%m%p') logger_output(self.logger, 'info', '{0}: No songs in queue.'.format(right_now)) time.sleep(self.queue_speed) except KeyboardInterrupt: logger_output(self.logger, 'info', ' Quit') self.gpio.cleanup()
def eleven(self): logger_output(self.logger, 'info', 'sending number 11') self.gpio.setup(5, self.gpio.OUT) self.gpio.output(6, self.gpio.HIGH) time.sleep(1) self.gpio.setup(6, self.gpio.IN)
def twelve(self): logger_output(self.logger, 'info', 'sending number 12') self.gpio.setup(13, self.gpio.OUT) self.gpio.output(13, self.gpio.HIGH) time.sleep(1) self.gpio.setup(13, self.gpio.IN)
def eight(self): logger_output(self.logger, 'info', 'sending number 8') self.gpio.setup(9, self.gpio.OUT) self.gpio.output(9, self.gpio.HIGH) time.sleep(1) self.gpio.setup(9, self.gpio.IN)
def nine(self): logger_output(self.logger, 'info', 'sending number 9') self.gpio.setup(11, self.gpio.OUT) self.gpio.output(11, self.gpio.HIGH) time.sleep(1) self.gpio.setup(11, self.gpio.IN)
def seven(self): logger_output(self.logger, 'info', 'sending number 7') self.gpio.setup(10, self.gpio.OUT) self.gpio.output(10, self.gpio.HIGH) time.sleep(1) self.gpio.setup(10, self.gpio.IN)
def six(self): logger_output(self.logger, 'info', 'sending number 6') self.gpio.setup(22, self.gpio.OUT) self.gpio.output(22, self.gpio.HIGH) time.sleep(1) self.gpio.setup(22, self.gpio.IN)
def five(self): logger_output(self.logger, 'info', 'sending number 5') self.gpio.setup(27, self.gpio.OUT) self.gpio.output(27, self.gpio.HIGH) time.sleep(1) self.gpio.setup(27, self.gpio.IN)
def four(self): logger_output(self.logger, 'info', 'sending number 4') self.gpio.setup(17, self.gpio.OUT) self.gpio.output(17, self.gpio.HIGH) time.sleep(1) self.gpio.setup(17, self.gpio.IN)
def three(self): logger_output(self.logger, 'info', 'sending number 3') self.gpio.setup(4, self.gpio.OUT) self.gpio.output(4, self.gpio.HIGH) time.sleep(1) self.gpio.setup(4, self.gpio.IN)