def put(self, pos): channel = int(pos) colors = self.settings.colors colors[channel] = rgbFromHex(self.request.body) self.settings.arduino.update(colors) self.set_header("Content-Type", "text/plain") self.write("updated %r" % colors)
def put(self, which): which = int(which) brites = self.settings.brites if which + 1 > len(brites): brites.extend([(0, 0, 0)] * (which + 1 - len(brites))) brites[which] = rgbFromHex(self.request.body) self.settings.arduino.setLeds(brites) self.set_header("Content-Type", "text/plain") self.write("ok")