コード例 #1
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)
コード例 #2
0
def cleanup():
    if utf8.is_active():
        utf8.terminate()
    if plasma.is_active():
        plasma.terminate()
    if message.is_active():
        message.terminate()

    scrollphathd.set_brightness(BRIGHTNESS)
    scrollphathd.set_font(font5x7)

    scrollphathd.clear()
    scrollphathd.show()
コード例 #3
0
ファイル: font-gallery.py プロジェクト: Kisty/scroll-phat-hd
def scroll_message(font, message):
    scrollphathd.set_font(font)
    scrollphathd.clear()  # Clear the display and reset scrolling to (0, 0)
    length = scrollphathd.write_string(message)  # Write out your message
    scrollphathd.show()  # Show the result
    time.sleep(0.5)  # Initial delay before scrolling

    length -= scrollphathd.width

    # Now for the scrolling loop...
    while length > 0:
        scrollphathd.scroll(1)  # Scroll the buffer one place to the left
        scrollphathd.show()  # Show the result
        length -= 1
        time.sleep(0.02)  # Delay for each scrolling step

    time.sleep(0.5)  # Delay at the end of scrolling
コード例 #4
0
#!/usr/bin/env python
import scrollphathd
from scrollphathd.api.http import scrollphathd_blueprint
from scrollphathd.fonts import font3x5
from flask import Flask

# Set the font
scrollphathd.set_font(font3x5)
# Set the brightness
scrollphathd.set_brightness(0.5)
# 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)

if __name__ == "__main__":
    app = Flask(__name__)

    app.register_blueprint(scrollphathd_blueprint)

    @app.route('/')
    def index():
        return """<html><head><title>Scroll pHAT HD - API Demo</title></head><body>
<h1>Scroll pHAT HD - API Demo</h1>
<p>This simple API demo shows you how to blend Scroll pHAT's HTTP API blueprint into a Flask application, so you can control your Scroll pHAT HD over HTTP.</p>
<fieldset><legend><b>Text</b></legend>
    <form method="post" action="/show"><table style='width:100%'><tr>
        <td style='width:100%'><input style='width:99%' type="text" name="text" value="Hello World"></td>
        <td><input type="submit" value="Display"></td>
    </tr></table></form>
</fieldset><fieldset><legend><b>Scroll</b></legend>
    <div>
コード例 #5
0
#!/usr/bin/env python

import time

import scrollphathd
from scrollphathd.fonts import font5x7unicode

scrollphathd.set_font(font5x7unicode)

print("""
Scroll pHAT HD: Simple Scrolling

A simple example showing a basic scrolling loop for scrolling
single messages across the display.

Press Ctrl+C to exit.
""")


def scroll_message(message):
    scrollphathd.clear()  # Clear the display and reset scrolling to (0, 0)
    length = scrollphathd.write_string(message)  # Write out your message
    scrollphathd.show()  # Show the result
    time.sleep(0.5)  # Initial delay before scrolling

    length -= scrollphathd.width

    # Now for the scrolling loop...
    while length > 0:
        scrollphathd.scroll(1)  # Scroll the buffer one place to the left
        scrollphathd.show()  # Show the result
コード例 #6
0
import zmq
import re
import scrollphathd
from scrollphathd.fonts import font3x5
from scrollphathd.fonts import font5x5
from scrollphathd.fonts import font5x7
from scrollphathd.fonts import font5x7smoothed
import fontorgan
import fonthachicro
import fontgauntlet
import fontd3
import fontmonkey
import fontball

scrollphathd.rotate(degrees=180)
scrollphathd.set_font( fontd3 )
font_width = fontd3.width
timeout = 0
scroll_time = 0
base_brightness = 1.0
show_ball = False

print( 'starting display server' )
context = zmq.Context()
socket = context.socket(zmq.PULL)
socket.bind('tcp://127.0.0.1:5555')

while True:
    if socket.poll(10, zmq.POLLIN):
        msg = socket.recv(zmq.NOBLOCK)
        #print repr(msg)
コード例 #7
0
c = 0

shp_y = 3
shp_y2 = 3
blt_x = 0
blt_x2 = 0
blt_y = 0
blt_y2 = 0
trg_x = 0
trg_x2 = 0
trg_y = 0
trg_y2 = 0

scr.set_brightness(bright)
scr.set_font(font=font5x7)
scr.set_clear_on_exit(value=True)

btn.set_pixel(0, 0, 0)


def show_msg(msg):
    scr.clear()
    scr.write_string(msg, x=0, y=0, brightness=bright)
    scr.show()
    time.sleep(delay * 20)

    [bw, bh] = scr.get_buffer_shape()
    for y in [1, -1, 1]:
        for x in range(0, bw - width - 1):
            scr.scroll(x=y, y=0)
コード例 #8
0
import math

import scrollphathd
from scrollphathd.fonts import font5x5
from scrollphathd.fonts import font5x7
from six import unichr

from threading import Thread

scrollphathd.clear()
scrollphathd.show()

scrollphathd.rotate(degrees=180)
BRIGHTNESS = 0.3
scrollphathd.set_brightness(BRIGHTNESS)
scrollphathd.set_font(font5x7)
scrollphathd.write_string('Flask up')


class Plasma():
    def __init__(self):
        self._running = True

    def terminate(self):
        self._running = False

    def is_active(self):
        return self._running

    def run(self):
        self._running = True