예제 #1
0
파일: clock.py 프로젝트: KEClaytor/HexPi
 def __call__(self):
     #print datetime.now()
     hour = datetime.now().hour
     minute = datetime.now().minute
     clockstate = setface(hour,minute)
     out.set_states_all(clockstate)
     # we only have to update once a resolution cycle
     #ut = RESMIN - (minute - (minute/RESMIN)*RESMIN )
     #sleep(ut*60+1)
     return
예제 #2
0
파일: Hex.py 프로젝트: KEClaytor/HexPi
 def __call__(self):
     print self.message
     for char in self.message:
         if char not in ls.letter_dict:
             continue
         out.set_states_all(ls.letter_dict[char])
         sleep(1)
         patterns.all_off().draw()
         sleep(0.05)
     sleep(5)
     return
예제 #3
0
파일: life.py 프로젝트: KEClaytor/HexPi
    def __call__(self):
        # See if this element survives
        vec = [0]*2n
        for x in range(len(vec)):
            self.strength = self.str_self*self.state[x] + \
                    self.str_near*dotprod(self.state, Adjacent[x]) - \
                    self.str_nega*dotprod(invvec(self.state), Adjacent[x])

            if strength > self.thresh:
                vec[x] = 1

        self.state = vec
        out.set_states_all(self.state)

        sleep(self.waits)

        return
예제 #4
0
파일: debug.py 프로젝트: KEClaytor/HexPi
def debug_clock():
    for hour in range(24):
        for minute in range(60):
            clockstate = clock.setface(hour,minute)
            out.set_states_all(clockstate)
            # we only have to update once a resolution cycle
            ut = clock.RESMIN - \
                (minute - (minute/clock.RESMIN)*clock.RESMIN )
            # Print out text to double check
            print ""
            print "current hour: " + repr(hour)
            print "current minute: " + repr(minute)
            print "resolution: " + repr(RESMIN)
            print clockstate
            print "next update in: " +repr(ut) + " min"
            sleep(.1)
    return
예제 #5
0
파일: debug.py 프로젝트: KEClaytor/HexPi
def debug_echo():
    while True:
        char = raw_input()
        if char in ls.letter_dict:
            out.set_states_all(ls.letter_dict[char])
    return