Beispiel #1
0
 def run(self):
     """
     the threading main loop in dependency of the exchanged programstate variable.
     counts the ticks with a switch condition, meaning a count will only be 
     recongnized as such when the value switches from High to Low.
     ###
     RETURNS (void)
     """
     self.exchange.log("[+] running Geiger Thread")
     # main loop with exchanged programstate condition
     t_start = time.time()
     # condition to add a count. will only add a count, if there has been a change
     # in value, meianing whenever the previous value was 0 and the claue then changed
     # to True
     prev_value = 0
     try:
         while self.exchange.programstate:
             # the time difference, later being checked with the interval variable
             t_delta = time.time() - t_start
             if self.port.get_state() == 1 and prev_value == 0:
                 prev_value = 1
             elif self.port.get_state() == 0 and prev_value == 1:
                 prev_value = 0
                 self.count += 1
             if t_delta >= self.interval:
                 # udpadating the exchanged geiger value and resetting the count variable
                 self._update_data()
                 t_start = time.time()
     finally:
         self.exchange.log("[*] terminated Geiger Thread")
         gpio.cleanup()
Beispiel #2
0
 def run(self):
     """
     actually starting the animations
     ###
     RETURNS (void)
     """
     # the amount of repetitions 
     try:
         while (True):
             self.raindrops(20, 100)
             self.pause()
             self.vertical_lines(3, 150)
             self.pause()
             self.horizontal_lines(3, 150)
             self.pause()
             self.inverting_chess(8, 100)
             self.pause()
             self.rings(8, 100)
             self.pause()
     except:
         io.cleanup()
         sys.exit()