예제 #1
0
def main():
    brightness = 0
    last_time = None
    show_colon = False
    ldr = LightSensor(LDR_PIN)

    if "flip" in sys.argv:
        sphd.rotate(180)

    while True:
        now = datetime.now()
        current_time = (now.hour, now.minute)
        old_brightness = brightness
        brightness = MAX_BRIGHTNESS if ldr.light_detected else 0.1

        if current_time != last_time or brightness != old_brightness:
            sphd.clear()
            draw_digit(0, 0, now.hour // 10, brightness)
            draw_digit(4, 0, now.hour % 10, brightness)
            draw_digit(10, 0, now.minute // 10, brightness)
            draw_digit(14, 0, now.minute % 10, brightness)
            last_time = current_time

        if show_colon != (now.microsecond <
                          500000) or brightness != old_brightness:
            show_colon = now.microsecond < 500000
            sphd.set_pixel(8, 1, brightness * show_colon)
            sphd.set_pixel(8, 5, brightness * show_colon)
            sphd.show()

        time.sleep(0.01)
예제 #2
0
 def countdown(self):
     scrollphathd.set_brightness(0.5)
     scrollphathd.rotate(0)
     # 3 - 2 - 1
     scrollphathd.clear()
     scrollphathd.write_string('3', x=6, y=0, font=font5x7)
     scrollphathd.show()
     time.sleep(0.75)
     scrollphathd.clear()
     scrollphathd.show()
     time.sleep(0.25)
     scrollphathd.clear()
     scrollphathd.write_string('2', x=6, y=0, font=font5x7)
     scrollphathd.show()
     time.sleep(0.75)
     scrollphathd.clear()
     scrollphathd.show()
     time.sleep(0.25)
     scrollphathd.clear()
     scrollphathd.write_string('1', x=7, y=0, font=font5x7)
     scrollphathd.show()
     time.sleep(0.75)
     scrollphathd.clear()
     scrollphathd.show()
     time.sleep(0.25)
     return
예제 #3
0
def clock():
    scrollphathd.rotate(180)
    scrollphathd.clear()
    str1 = time.strftime("%H%M")
    scrollphathd.write_string(str1, x=1, y=1, font=font3x5, brightness=0.01)
    scrollphathd.show()
    time.sleep(0.1)
예제 #4
0
def mainloop():
    while True:
        # not q.empty():
        status = q.get()
        scrollphathd.write_string(status, font=font5x7smoothed, brightness=0.1)
        status_length = scrollphathd.write_string(status,
                                                  x=0,
                                                  y=0,
                                                  font=font5x7smoothed,
                                                  brightness=0.1)
        #print(status)
        #print ("<<<<<< Scrolling tweet", status)
        time.sleep(0.25)
        #print 'status length --->',status_length
        while status_length > 0:
            #print 'status length',status_length
            #print 'buffer_len',scrollphathd.write_string(status, x=0, y=0,font=font5x7smoothed, brightness=0.1)
            #scrollphathd.flip(x=True)
            scrollphathd.rotate(degrees=180)
            scrollphathd.show()
            scrollphathd.scroll(1)
            status_length -= 1
            time.sleep(0.01)
        else:
            #scrollphathd.scroll(0)
            #print ">>status length is zero<<"
            scrollphathd.clear()
예제 #5
0
def sticker(memo, input, duration):
    '''Sticker Scroller by AZcoigreach'''
    try:
        click.clear()
        click.secho('Sticker Scroll Running...', fg='red')
        scrollphathd.rotate(degrees=180)
        tmp = str('')
        msg = ' .'
        scrollphathd.write_string(str(msg), font=font3x5, brightness=0.15)
        while True:
            data = pd.DataFrame(pickle.load(open(input, 'rb')))
            datatest = str(data)
            logging.debug('data DataFrame: %s', datatest)
            logging.debug('tmp DataFrame: %s', tmp)
            if datatest != tmp:
                logging.info('Updating DataFrame...')
                tmp = str(data)
                data = data.tail(1)
                data = data.iloc[0, 3]
                msg = memo + str(data)
                scrollphathd.clear()
                scrollphathd.write_string(str(msg),
                                          font=font3x5,
                                          brightness=0.15)
                click.secho(msg, fg='yellow')
            logging.debug('Updating LED...')
            scrollphathd.show()
            scrollphathd.scroll()
            time.sleep(duration)
    except Exception as err:
        logger.error('Scroll Error: %s', err)
        time.sleep(5)
        sticker()
예제 #6
0
def mainloop():
    scrollphathd.rotate(degrees=180)
    scrollphathd.clear()
    scrollphathd.show()

    while True:
        # grab the tweet string from the queue
        try:
            scrollphathd.clear()
            status = q.get(False)
            scrollphathd.write_string(status,font=font5x7, brightness=0.1)
            status_length = scrollphathd.write_string(status, x=0, y=0,font=font5x7, brightness=0.1)
            time.sleep(0.25)

            while status_length > 0:
                scrollphathd.show()
                scrollphathd.scroll(1)
                status_length -= 1
                time.sleep(0.02)


            scrollphathd.clear()
            scrollphathd.show()
            time.sleep(0.25)

            q.task_done()

        except queue.Empty:
            time.sleep(1)
예제 #7
0
 def endrec(self):
     scrollphathd.set_brightness(0.5)
     scrollphathd.rotate(0)
     scrollphathd.clear()
     scrollphathd.write_string('ok', x=3, y=0)
     scrollphathd.show()
     return
예제 #8
0
    def run(self):
        global current_value
        next_value = 0.0

        scrollphathd.set_font(font5x7)
        scrollphathd.set_brightness(0.2)
        scrollphathd.rotate(degrees=180)

        while self.running:

            if next_value == 0.0:
                next_value_string = ""
            else:
                next_value_string = self.format_value(next_value)

            if current_value == 0.0:
                curr_value_string = "loading.. "
            else:
                curr_value_string = self.format_value(current_value)
                next_value = current_value

            string_to_display = curr_value_string + next_value_string

            scrollphathd.clear()
            str_len = scrollphathd.write_string(string_to_display)
            for _ in range(str_len):
                scrollphathd.show()
                scrollphathd.scroll()
                time.sleep(0.05)
예제 #9
0
def mainloop():
    scrollphathd.rotate(degrees=180)
    scrollphathd.clear()
    scrollphathd.show()

    while True:
        # grab the tweet string from the queue
        try:
            scrollphathd.clear()
            status = q.get(False)

            scrollphathd.write_string(status, font=font5x7, brightness=0.1)
            status_length = scrollphathd.write_string(status,
                                                      x=0,
                                                      y=0,
                                                      font=font5x7,
                                                      brightness=0.1)
            time.sleep(0.25)

            while status_length > 0:
                scrollphathd.show()
                scrollphathd.scroll(1)
                status_length -= 1
                time.sleep(0.02)

            scrollphathd.clear()
            scrollphathd.show()
            time.sleep(0.25)

            q.task_done()

        except queue.Empty:
            float_sec = (time.time() % 60) / 59.0
            seconds_progress = float_sec * 15

            if DISPLAY_BAR:
                for y in range(15):
                    current_pixel = min(seconds_progress, 1)
                    scrollphathd.set_pixel(y + 1, 6,
                                           current_pixel * BRIGHTNESS)
                    seconds_progress -= 1
                    if seconds_progress <= 0:
                        break

            else:
                scrollphathd.set_pixel(int(seconds_progress), 6, BRIGHTNESS)

            scrollphathd.write_string(time.strftime("%H:%M"),
                                      x=0,
                                      y=0,
                                      font=font5x5,
                                      brightness=BRIGHTNESS)

            if int(time.time()) % 2 == 0:
                scrollphathd.clear_rect(8, 0, 1, 5)

            scrollphathd.show()
            time.sleep(0.25)
def scrollList(output):
    #accepts a list of strings and displays to the scrollphat
    #buffer size is limited, suggesting to limit lines < 10, depending on length of each object

    #setup the display default parameters
    scrollphathd.rotate(displayrotation)
    scrollphathd.set_brightness(displaybrightness)
    # displayRewind = True # rapidly displayRewind after the last line
    # delay = 0.009 # Delay is the time (in seconds) between each pixel scrolled

    # Draw each line in lines to the Scroll pHAT HD buffer
    scrollphathd.clear()  #clear the buffer before displaying the next list
    line_height = scrollphathd.DISPLAY_HEIGHT + 3  # Determine how far apart each line should be spaced vertically
    offset_left = 0  # Store the left offset for each subsequent line (starts at the end of the last line)
    lengths = [0] * len(output)  # Get the length of each 'line' for the buffer

    for line, text in enumerate(output):
        lengths[line] = scrollphathd.write_string(
            text, x=offset_left, y=line_height * line
        )  # scrollphathd.write_string returns the length of the written string in pixels
        offset_left += lengths[
            line]  # we can use this length to calculate the offset of the next line for scrolling effect lateer

    scrollphathd.set_pixel(
        offset_left - 1, (len(output) * line_height) - 1, 0
    )  # adds some horizontal/vertical padding to the buffer at the very bottom right of the last line to wrap nice
    scrollphathd.scroll_to(0, 0)  # Reset animation
    scrollphathd.show()

    pos_x = 0  # Keep track of the X and Y position for the displayRewind effect
    pos_y = 0

    for current_line, line_length in enumerate(lengths):
        time.sleep(
            displayScrollSpeed *
            10)  # Delay a slightly longer time at the start of each line
        for y in range(line_length):  # Scroll to the end of the current line
            scrollphathd.scroll(1, 0)
            pos_x += 1
            time.sleep(displayScrollSpeed)
            scrollphathd.show()

        if current_line == len(
                output
        ) - 1 and displayRewind:  # If on the very last line and displayRewind is True, rapidly scroll back to the first line.
            for y in range(pos_y):
                scrollphathd.scroll(-int(pos_x / pos_y), -1)
                scrollphathd.show()
                time.sleep(displayScrollSpeed)
                scrollphathd.clear()  #Clear the buffer

        else:  # Otherwise, progress to the next line by scrolling upwards
            for x in range(line_height):
                scrollphathd.scroll(0, 1)
                pos_y += 1
                scrollphathd.show()

    time.sleep(displayScrollSpeed)
예제 #11
0
	def __init__(self):
		super(LedManager, self).__init__(target=self._loop)
		leds.rotate(180)
		leds.clear()
		leds.set_brightness(0.2)
		self.daemon = True
		self.scroll_remaining = 0
		self.phrases = []
		self.start()
예제 #12
0
def main():
    scrollphathd.set_brightness(0.5)
    scrollphathd.rotate(180)
    scrollphathd.clear()

    countdown(datetime.datetime(2018, 12, 16, 18, 0, 0))
    scrollMessage("   KNALLEN!!!   ")
    countdown(datetime.datetime(2018, 12, 18, 18, 0, 0))
    scrollMessage("   STOPPEN!!!   ")
예제 #13
0
 def startstop(self):
     if self._is_enabled is False:
         logging.info("Starting Autoscroll")
         self._is_enabled = True
         # if ROTATED != 0:
         logging.info("Autoscroll rotated {}".format(ROTATED))
         scrollphathd.rotate(degrees=ROTATED)
         self.run()
     else:
         self._is_enabled = False
예제 #14
0
 def start(self):
     # Uncomment the below if your display is upside down
     #   (e.g. if you're using it in a Pimoroni Scroll Bot)
     scrollphathd.rotate(degrees=180)
     
     start = time.time()
     end=start + 1 + 10 #25 * 60
     
     while end>time.time():
         scrollphathd.clear()
         now=time.time()
         delta_t=end-now
         secs=int(delta_t)
         
         text=datetime.fromtimestamp(delta_t).strftime("%M:%S")
         # Display the time (HH:MM) in a 5x5 pixel font
         scrollphathd.write_string(
             text,
             x=0, # Align to the left of the buffer
             y=0, # Align to the top of the buffer
             font=font5x5, # Use the font5x5 font we imported above
             brightness=BRIGHTNESS # Use our global brightness value
         )
     
         # int(time.time()) % 2 will tick between 0 and 1 every second.
         # We can use this fact to clear the ":" and cause it to blink on/off
         # every other second, like a digital clock.
         # To do this we clear a rectangle 8 pixels along, 0 down,
         # that's 1 pixel wide and 5 pixels tall.
         if int(time.time()) % 2 == 0:
             scrollphathd.clear_rect(8, 0, 1, 5)
     
         # Display our time and sleep a bit. Using 1 second in time.sleep
         # is not recommended, since you might get quite far out of phase
         # with the passing of real wall-time seconds and it'll look weird!
         #
         # 1/10th of a second is accurate enough for a simple clock though :D
         scrollphathd.show()
         time.sleep(0.1)
     
     scrollphathd.clear()
     scrollphathd.show()
     scrollphathd.write_string(
         "Time's up! ",
         x=0, # Align to the left of the buffer
         y=0, # Align to the top of the buffer
         font=font5x7, # Use the font5x5 font we imported above
         brightness=BRIGHTNESS # Use our global brightness value
     )
     
     while True:
         scrollphathd.scroll()
         scrollphathd.show()
         time.sleep(0.1)
예제 #15
0
 def clockVert(self):
     scrollphathd.set_brightness(0.3)
     scrollphathd.rotate(270)
     scrollphathd.clear()
     # Ore
     scrollphathd.write_string(time.strftime("%H"), x=0, y=0, font=font5x5)
     # Minuti
     scrollphathd.write_string(time.strftime("%M"), x=0, y=6, font=font5x5)
     # Secondi
     scrollphathd.write_string(time.strftime("%S"), x=0, y=12, font=font5x5)
     scrollphathd.show()
     return
예제 #16
0
 def recblink(self):
     scrollphathd.set_brightness(0.15)
     scrollphathd.rotate(0)
     for i in range(5):
         scrollphathd.clear()
         scrollphathd.write_string('REC', x=0, y=0)
         scrollphathd.show()
         time.sleep(0.7)
         scrollphathd.clear()
         scrollphathd.show()
         time.sleep(0.3)
     return
예제 #17
0
 def LEDmessage(self, txtMessage, loop=False):
     self.DisplayOff()
     scrollphathd.rotate(0)
     scrollphathd.clear()
     scrollphathd.set_brightness(0.5)
     scrollphathd.write_string(txtMessage, x=18, y=0, font=font5x7)
     if loop == True:
         self.textMessageDisplay = True
         self.LEDscrollLeft = 0
     else:
         self.textMessageDisplay = False
         self.LEDscrollLeft = scrollphathd.get_buffer_shape()[0]
         #print self.LEDscrollLeft
         #print self.scrollphathd.get_buffer_shape()
     scrollphathd.show()
     self.clockDisplay = False
예제 #18
0
    def __init__(self, rotate=True, font=font3x5):
        if rotate:
            scrollphathd.rotate(180)
        self.font = font
        self.brightness = 1.0
        scrollphathd.write_string('Starting Weather....',
                                  x=1,
                                  y=1,
                                  font=self.font,
                                  brightness=self.brightness)
        for i in range(0, 75):
            scrollphathd.show()
            scrollphathd.scroll()
            time.sleep(0.05)

        scrollphathd.clear()
예제 #19
0
def display_data(p_data='No Data '):
    config = get_current_config(silent=True)

    scrollphathd.rotate(180)
    scrollphathd.set_brightness(0.3)
    delay = 0.1

    scrollphathd.write_string(config.p_data,
                              x=0,
                              y=0,
                              font=font5x7,
                              brightness=0.5)

    while True:
        scrollphathd.show()
        scrollphathd.scroll()
        time.sleep(delay)
예제 #20
0
 def clockHor(self):
     scrollphathd.set_brightness(0.5)
     scrollphathd.rotate(0)
     scrollphathd.clear()
     BRIGHTNESS = 0.7
     # prende il resto della divisione per 60 (= secondi) e lo convert nel campo 0.0-15.0
     seconds_progress = 15 * (
         (time.time() % 60) / 59.0)  # ogni pixel sono 4 secondi
     # barra dei secondi a luminosita' variabile
     for y in range(15):  # 15 = numero di pixel
         # For each pixel, we figure out its brightness by
         # seeing how much of "seconds_progress" is left to draw
         # If it's greater than 1 (full brightness) then we just display 1.
         current_pixel = min(seconds_progress, 1)
         # Multiply the pixel brightness (0.0 to 1.0) by our global brightness value
         scrollphathd.set_pixel(y + 1, 6, current_pixel * BRIGHTNESS)
         # Subtract 1 now we've drawn that pixel
         seconds_progress -= 1
         # If we reach or pass 0, there are no more pixels left to draw
         if seconds_progress <= 0:
             break
     # Display the time (HH:MM) in a 5x5 pixel font
     scrollphathd.write_string(
         time.strftime("%H:%M"),
         x=0,  # Align to the left of the buffer
         y=0,  # Align to the top of the buffer
         font=font5x5,  # Use the font5x5 font we imported above
         brightness=BRIGHTNESS  # Use our global brightness value
     )
     # int(time.time()) % 2 will tick between 0 and 1 every second.
     # We can use this fact to clear the ":" and cause it to blink on/off
     # every other second, like a digital clock.
     # To do this we clear a rectangle 8 pixels along, 0 down,
     # that's 1 pixel wide and 5 pixels tall.
     if int(time.time()) % 2 == 0:
         scrollphathd.clear_rect(8, 0, 1, 5)
     # Display our time and sleep a bit. Using 1 second in time.sleep
     # is not recommended, since you might get quite far out of phase
     # with the passing of real wall-time seconds and it'll look weird!
     #
     # 1/10th of a second is accurate enough for a simple clock though :D
     scrollphathd.show()
     return
예제 #21
0
 def takePhoto(self):
     self.DisplayOff()
     scrollphathd.rotate(0)
     scrollphathd.set_brightness(0.25)
     #scorre scritta foto
     scrollphathd.clear()
     scrollphathd.write_string('foto', x=18, y=0, font=font5x7)
     scrollphathd.show()
     buffL = scrollphathd.get_buffer_shape()[0]
     time.sleep(0.5)
     for i in range(buffL + 1):
         scrollphathd.show()
         scrollphathd.scroll()
         time.sleep(0.015)
     # cancella immagine precedente
     try:
         os.remove('image.jpg')
     except OSError:
         pass
     self.camera.resolution = (1920, 1080)
     time.sleep(0.25)
     self.countdown()
     # clic (piccolo flash)
     scrollphathd.clear()
     scrollphathd.set_brightness(0.7)
     scrollphathd.fill(1, x=0, y=0, width=17, height=7)
     #scrollphathd.write_string('c', x= 0, y=0)
     #scrollphathd.write_string('l', x= 5, y=0)
     #scrollphathd.write_string('i', x= 9, y=0)
     #scrollphathd.write_string('c', x=12, y=0)
     scrollphathd.show()
     #scatta la foto
     time.sleep(0.05)
     scrollphathd.clear()
     scrollphathd.show()
     time.sleep(0.15)
     # scatta la foto
     self.camera.capture('image.jpg')
     return
예제 #22
0
def mainloop():
    scrollphathd.rotate(degrees=180)

    # On start-up display the hostname
    on_boot()
    init_queue()
    reset()

    while True:
        # grab the tweet string from the queue
        try:
            scrollphathd.clear()
            status = incoming_q.get(False)

            # if we receive a :CLEAR command reinitialise the queue
            if ':CLEAR' in status:
                init_queue()
                continue

            scrollphathd.write_string(status, font=FONT, brightness=DISPLAY_BRIGHTNESS)
            status_length = scrollphathd.write_string(status, x=0, y=0, font=FONT, brightness=DISPLAY_BRIGHTNESS)
            time.sleep(0.25)

            scroll(status_length)

            reset()
            time.sleep(0.25)

            incoming_q.task_done()
            incoming_q.put(status)

            logging.debug(u'Pending tweet queue size = {}'.format(str(incoming_q.qsize())))

        except queue.Empty:
            time.sleep(1)

        except Exception:
            logging.exception("Something went wrong in mainloop()")
예제 #23
0
 def makeVideo(self):
     self.DisplayOff()
     scrollphathd.rotate(0)
     scrollphathd.set_brightness(0.25)
     #scorre scritta video
     scrollphathd.clear()
     scrollphathd.write_string('video', x=18, y=0, font=font5x7)
     scrollphathd.show()
     buffL = scrollphathd.get_buffer_shape()[0]
     time.sleep(0.5)
     for i in range(buffL + 1):
         scrollphathd.show()
         scrollphathd.scroll()
         time.sleep(0.015)
     # cancella video precedente
     try:
         os.remove('video.h264')
     except OSError:
         pass
     try:
         os.remove('video.mp4')
     except OSError:
         pass
     self.camera.resolution = (1280, 720)
     time.sleep(0.25)
     self.countdown()
     # registra
     self.camera.start_recording('video.h264')
     # lampeggia REC per 5 secondi
     self.recblink()
     # fine registrazine
     self.camera.stop_recording()
     # scrive ok
     self.endrec()
     time.sleep(1)
     self.DisplayOff()
예제 #24
0
def main():
    scrollphathd.rotate(180)

    print("""
Overbeautiful clock

Press Ctrl+C to exit!
    """)

    scrollphathd.set_brightness(0.5)

    while True:
        subroutine_anim_picker = pick_next_anim()
        current_subroutine = next(subroutine_anim_picker)
        #current_subroutine = display_animated_square()
        time_displaying = True
        last_time_changed = math.floor(time.time())
        while True:
            time.sleep(0.05)
            try:
                next(current_subroutine)
            except StopIteration:
                current_subroutine = next(subroutine_anim_picker)
                next(current_subroutine)
예제 #25
0
    # This adds a little bit of horizontal/vertical padding into the buffer at
    # the very bottom right of the last line to keep things wrapping nicely.
    scrollphathd.set_pixel(offset_left - 1, (len(lines) * line_height) - 1, 0)
    return


#check for hardware and make sure no GPIO / hardware faults

try:
    print "Checking Hardware ScrollPhat HD is availble"
    scrollphathd.scroll_to(0, 0)
    print " Passed!"

    print "Rotatng display - for placing upside down with Pi zero"
    scrollphathd.rotate(180)

except KeyboardInterrupt:
    # here you put any code you want to run before the program
    # exits when you press CTRL+C
    print "\n", counter  # print value of counter

except:
    # this catches ALL other exceptions including errors.
    # You won't get any error messages for debugging
    # so only use it once your code is working
    print "Hardware Error SchrollPhat HD is no responding. Check hardware."

#finally:
#    GPIO.cleanup() # this ensures a clean exit
예제 #26
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrollphathd as light
import math
import time
import sleep

print('Press Ctrl-C to interrupt...')
## Write your code here
light.write_string("187")
while True:
    light.show()
    light.rotate(180)
    light.scroll(1)
    light.sleep(0.5)
예제 #27
0
print("""
Scroll pHAT HD: Graph

Displays a graph with random values.

Press Ctrl+C to exit!

""")

MIN_VALUE = 0
MAX_VALUE = 50

# Uncomment the below if your display is upside down
#   (e.g. if you're using it in a Pimoroni Scroll Bot)
scrollphathd.rotate(degrees=180)

# Begin with a list of 17 zeros
values = [0] * scrollphathd.DISPLAY_WIDTH

while True:
    # Insert a random value at the beginning
    values.insert(0, random.randrange(MIN_VALUE, MAX_VALUE))

    # Get rid of the last value, keeping the list at 17 (DISPLAY_WIDTH) items
    values = values[:scrollphathd.DISPLAY_WIDTH]

    # Plot the random values onto Scroll pHAT HD
    scrollphathd.set_graph(values,
                           low=MIN_VALUE,
                           high=MAX_VALUE,
예제 #28
0
#!/usr/bin/env python

import scrollphathd as sphd
from scrollphathd.fonts import font5x7

import time

sphd.rotate(180)

# Left Fang
sphd.set_pixel(2, 0, 0.5)
sphd.set_pixel(6, 0, 0.5)
sphd.set_pixel(3, 1, 0.5)
sphd.set_pixel(5, 1, 0.5)
sphd.set_pixel(4, 2, 0.5)

# Right Fang
sphd.set_pixel(11, 0, 0.5)
sphd.set_pixel(15, 0, 0.5)
sphd.set_pixel(12, 1, 0.5)
sphd.set_pixel(14, 1, 0.5)
sphd.set_pixel(13, 2, 0.5)
sphd.show()

time.sleep(5)

sphd.clear()

while True:

    sphd.write_string("Hello World! I am Yeti!!!! Rawrrr!!                ", x=0, y=0, font=font5x7, brightness=0.5)
예제 #29
0
#!/usr/bin/env python

import time

import scrollphathd
from scrollphathd.fonts import font5x5

print("""
Scroll pHAT HD: Portrait Clock
Displays hours, minutes and seconds in text.
Press Ctrl+C to exit!
""")

scrollphathd.set_brightness(0.3)
scrollphathd.rotate(270)

while True:
    scrollphathd.clear()
    # See https://docs.python.org/2/library/time.html
    # for more information on what the time formats below do.

    # Display the hour as two digits
    scrollphathd.write_string(time.strftime("%H"), x=0, y=0, font=font5x5)

    # Display the minute as two digits
    scrollphathd.write_string(time.strftime("%M"), x=0, y=6, font=font5x5)

    # Display the second as two digits
    scrollphathd.write_string(time.strftime("%S"), x=0, y=12, font=font5x5)

    scrollphathd.show()
예제 #30
0
#!/usr/bin/env python

import time

import scrollphathd

scrollphathd.set_pixel(0, 0, 1)
scrollphathd.set_pixel(1, 1, 1)

try:
    while True:
        for x in [0, 90, 180, 270]:
            scrollphathd.rotate(x)
            scrollphathd.show()
            time.sleep(0.1)

except KeyboardInterrupt:
    scrollphathd.fill(0)
    scrollphathd.show()
예제 #31
0
import datetime
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():