Beispiel #1
0
def main():
    # Parser handling
    parser = ArgumentParser()
    parser.add_argument("-p",
                        "--port",
                        type=int,
                        help="HTTP port.",
                        default=8080)
    parser.add_argument("-H",
                        "--host",
                        type=str,
                        help="HTTP host.",
                        default="0.0.0.0")
    args = parser.parse_args()

    # TODO Check
    scrollphathd.set_clear_on_exit(False)
    scrollphathd.write_string(str(args.port), x=1, y=1, brightness=0.1)
    scrollphathd.show()

    # Flash usage
    app = Flask(__name__)
    app.register_blueprint(scrollphathd_blueprint, url_prefix="/scrollphathd")

    app.run(port=args.port, host=args.host)
    cleanup()
    # Shut down the scheduler when exiting the app
    state.get_scheduler().shutdown()
Beispiel #2
0
def main():
    parser = ArgumentParser()
    parser.add_argument("-p",
                        "--port",
                        type=int,
                        help="HTTP port.",
                        default=8080)
    parser.add_argument("-H",
                        "--host",
                        type=str,
                        help="HTTP host.",
                        default="0.0.0.0")
    args = parser.parse_args()

    scrollphathd.set_clear_on_exit(False)
    scrollphathd.set_brightness(0.1)

    scrollphathd.write_string(str(args.port), font=font3x5, x=1, y=1)
    scrollphathd.show()
    app = Flask(__name__)
    app.register_blueprint(scrollphathd_blueprint, url_prefix="/scrollphathd")
    app.run(port=args.port, host=args.host)
    elif msg.topic == SERVER_LOAD_TOPIC:
        print msg.payload
        last_load_received = float(msg.payload)
        scrollphathd.clear_rect(0, 6, None, 1)  # None defaults to disqlay size
        brightness = 0.5
        if last_load_received > 8.0:
            brightness = 1
            last_load_received = 8
        load_bar_width = last_load_received / 8.0 * 17
        scrollphathd.fill(brightness * brightness_modifier,
                          int(17 - load_bar_width), 6, int(load_bar_width + 1),
                          1)
        scrollphathd.show()


scrollphathd.set_clear_on_exit()

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

if MQTT_USER is not None and MQTT_PASS is not None:
    print('Using username: {un} and password: {pw}'.format(un=MQTT_USER,
                                                           pw='*' *
                                                           len(MQTT_PASS)))
    client.username_pw_set(username=MQTT_USER, password=MQTT_PASS)

client.connect(MQTT_SERVER, MQTT_PORT, 60)

client.loop_forever()
Beispiel #4
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)
            scr.show()
def main():
    logging.basicConfig(level=logging.INFO)

    scrollphathd.set_clear_on_exit(True)
    autoscroll = AutoScroll()
    autoscroll.startstop()
Beispiel #6
0
import scrollphathd
import signal
import time
import sys
from scrollphathd.fonts import font3x5
#Ensure IP continues being displayed even when the script finishes running
scrollphathd.set_clear_on_exit(False)
#Take string to be displayed from an argument which will be passed when called
scrollphathd.write_string("---" + sys.argv[1],
                          y=1,
                          font=font3x5,
                          brightness=0.2)
x = 1
#Condition was required to maintain scrolling of text on screen (IP was too big to fit without scrolling)
while x == 1:
    scrollphathd.show()
    scrollphathd.scroll()
    time.sleep(0.2)