def run(self):
        # The WebSocketApp loop runs in it's own thread,
        # so make sure you call TheButton.close() when you're done with it!
        self.the_button.start()
        previous_colour='0' # Initialise previous colour
        try:
            while True:
                # Colours are in hexadecimal but the PlayBulb Candle required saturation in front of the value
                colour = self.the_button.limitless_colour
                # Set the PlayBulbs to the current flair colour
                # Resource: Protocols for PlayBulb products (https://github.com/Phhere/Playbulb)
                if colour != previous_colour:
                    self.led.set_color(colour, self.group)
                    previous_colour=colour
                # There's no built-in time persistence, so by default, lowest time is for the current session
                if self.the_button.lowest_time < self.last_lowest:
                    self.led.set_color('white', self.group)  # Flash when a new record is set
                    self.led.set_color(colour, self.group)
                    self.last_lowest = self.the_button.lowest_time
                    print("New button record! " + str(math.floor(self.last_lowest)))
                    previous_colour='0' # Reset previous colour so flashing stops before next colour change
        except KeyboardInterrupt:
            pass
        self.close()
dataset/ETHPy150Open ALPSquid/thebutton-monitor/src/examples/limitlessled_example.py/ButtonApp.run/original