Beispiel #1
0
def loop():

    struct pollfd pfd
    pfd.fd = open("/sys/class/gpio/gpioXXX/value", "r")
    pfd.events = POLLPRI
    pfd.revents = 0

    ready = poll(pfd, 1, -1)

    if(0 != pfd.revents):
        digitalWrite(GPIO1_4, HIGH)
        digitalWrite(GPIO1_4, LOW)

        sleep(.01)
        digitalWrite(GPIO1_4, HIGH)
        digitalWrite(GPIO1_4, LOW)

        sleep(.01)
        digitalWrite(GPIO1_4, HIGH)
        digitalWrite(GPIO1_4, LOW)
    sleep(.01) 
	def Pump(self):
		Channel.Pump(self)
		self.queue = []
		poll(map=self._map)
Beispiel #3
0
 def Pump(self):
     Channel.Pump(self)
     self.queue = []
     poll(map=self._map)
Beispiel #4
0
	def Pump(self):
		[c.Pump() for c in self.channels]
		poll(map=self._map)
                # read answer file, react
                f = open(''.join([dst_dir, 'answer_', exts[i], '.txt']))
                answer = f.read().split()
                f.close()
                if len(answer) > 0:
                    db = react_to_answer(username, password, docname, db, 
                                         names[ind], answer, next_date)
                    ext_pop.append(i)
                    print names[ind], answer
                    if answer[0] == 'accept':
                        print names[ind], answer
                        N -= 1

            # create html, send email, if needed
            else:
                date = poll(dst_dir, exts[i], next_date, following_date)
                send_email(emails[ind], date, ''.join([base_url, exts[i], '.html']), 
                           username, password, subject, message)

        # get rid of people who answered
        for i in range(len(ext_pop)):
            exts.pop(ext_pop[i])
            inds.pop(ext_pop[i])

        current_date = time.strftime('%Y%m%d')

        # if it is 4pm the day before, send out cancellation.
        if (current_date == str(int(next_date) - 1)) & (time.strftime('%H') == '16'):

            subject = 'No Astrocoffee tomorrow, unless YOU want to present.'
            message = dst_dir + 'astrocoffee-utils/gonna_cancel.txt'
Beispiel #6
0
 def Pump(self):
     [c.Pump() for c in self.channels]
     poll(map=self._map)