def _dequeue(): global status_length scrollphathd.clear() logger.info("len(q) = {}".format(len(q))) status = q.pop() status_length = scrollphathd.write_string(status, x=18, y=0, font=font5x7smoothed, brightness=0.4) + 17 scrollphathd.show() time.sleep(0.01)
def lights(): if not _scroll_finished(): _scroll() elif _scroll_finished() and any(q): _dequeue() else: scrollphathd.clear() scrollphathd.show() time.sleep(0.25)
def close(): scrollphathd.clear() scrollphathd.show()
import scrollphathd import time from scrollphathd.fonts import font5x7smoothed from twitterpibot.responses.Response import _one_in logger = logging.getLogger(__name__) scroll_until_x = 0 q = [ "Hello World" ] status_length = 0 scrollphathd.rotate(degrees=180) scrollphathd.clear() scrollphathd.show() def jump_queue(text): logger.info("_enqueue text = {}".format(text)) q.append(text) def enqueue(text): logger.info("_enqueue text = {}".format(text)) q.insert(0, text) def _dequeue(): global status_length
# construct our abc by bitshift and move a 1 to that index. o = 1 << ((a << 2) + (b << 1) + c) # set the output cell to 1 if it &s with the rule, othewise 0 outputRow[x] = 1 if o & rule else 0 # incrementally fill in the rows until we fill the last row # then roll up the display matrix and evolve the last row if row < 6: row = row + 1 else: matrix = numpy.roll(matrix, -1, axis=0) # set the matrix new row for the next redraw matrix[row] = outputRow # have a nap time.sleep(0.01 * speed) try: mainloop() except KeyboardInterrupt: scrollphathd.clear() scrollphathd.show() print("Exiting!") # here endeth the script
def screenClear(): sphd.clear() sphd.show()
#!/usr/bin/env python import scrollphathd as sphd import time xAdd = 1 x = 0 y = 0 while True: x += xAdd if (x == 0 or x == 16): xAdd *= -1 y += 1 if (y == 7): y = 0 sphd.clear() sphd.set_pixel(x, y, 0.5) sphd.show() time.sleep(0.01)
def show_yellow_string(message): sphd.clear() sphd.write_string(message, font=font3x5, brightness=0.5) sphd.show() sphd.scroll(1) time.sleep(0.1)