Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

Funhouse LCD
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Funhouse LCD

by Powderjockey on Sat May 15, 2021 10:08 pm

Is there a trick to get the code to display on the Funhouse screen? I received my Adabox and have been working thru numerous scripts, but this https://learn.adafruit.com/creating-fun ... cuitpython I can't get the display to show anything. The data is going to IO and shows up in the serial of Mu.

Using Circuit Python 6.2 and the libraries dated May 11, 21

Any suggestions?

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Re: Funhouse LCD

by dastels on Sun May 16, 2021 2:45 pm

If your code is making use of the display it won't be used to echo the serial output or REPL.

Dave

dastels
 
Posts: 6475
Joined: Tue Oct 20, 2015 3:22 pm

Re: Funhouse LCD

by Powderjockey on Sun May 16, 2021 4:54 pm

So if Mu is not open, the text should scroll on the display?

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Re: Funhouse LCD

by dastels on Sun May 16, 2021 5:20 pm

By default text (the output from CircuitPython and print statements in the code and REPL) should scroll on the display as well as a terminal emulator connected via the USB port. If the code running is using displayio then you won't see the scrolling text. It doesn't matter if anything is open on the port (e.g. Mu).

Does anything show on the screen?

Dave

dastels
 
Posts: 6475
Joined: Tue Oct 20, 2015 3:22 pm

Re: Funhouse LCD

by Powderjockey on Sun May 16, 2021 7:19 pm

Nothing shows on the screen. There are 5 LED's that show. The code.py is below.

Code: Select all | TOGGLE FULL SIZE
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
from adafruit_funhouse import FunHouse

funhouse = FunHouse(default_bg=None)
funhouse.peripherals.set_dotstars(0x800000, 0x808000, 0x008000, 0x000080, 0x800080)

# pylint: disable=unused-argument
def connected(client):
    print("Connected to Adafruit IO! Subscribing...")
    client.subscribe("buzzer")
    client.subscribe("neopixels")


def subscribe(client, userdata, topic, granted_qos):
    print("Subscribed to {0} with QOS level {1}".format(topic, granted_qos))


def disconnected(client):
    print("Disconnected from Adafruit IO!")


def message(client, feed_id, payload):
    print("Feed {0} received new value: {1}".format(feed_id, payload))
    if feed_id == "buzzer":
        if int(payload) == 1:
            funhouse.peripherals.play_tone(2000, 0.25)
    if feed_id == "neopixels":
        print(payload)
        color = int(payload[1:], 16)
        funhouse.peripherals.dotstars.fill(color)


# pylint: enable=unused-argument

# Initialize a new MQTT Client object
funhouse.network.init_io_mqtt()
funhouse.network.on_mqtt_connect = connected
funhouse.network.on_mqtt_disconnect = disconnected
funhouse.network.on_mqtt_subscribe = subscribe
funhouse.network.on_mqtt_message = message

print("Connecting to Adafruit IO...")
funhouse.network.mqtt_connect()
sensorwrite_timestamp = time.monotonic()
last_pir = None

while True:
    funhouse.network.mqtt_loop()

    print("Temp %0.1F" % funhouse.peripherals.temperature)
    print("Pres %d" % funhouse.peripherals.pressure)

    # every 10 seconds, write temp/hum/press
    if (time.monotonic() - sensorwrite_timestamp) > 10:
        funhouse.peripherals.led = True
        print("Sending data to adafruit IO!")
        funhouse.network.mqtt_publish("temperature", funhouse.peripherals.temperature)
        funhouse.network.mqtt_publish(
            "humidity", int(funhouse.peripherals.relative_humidity)
        )
        funhouse.network.mqtt_publish("pressure", int(funhouse.peripherals.pressure))
        sensorwrite_timestamp = time.monotonic()
        # Send PIR only if changed!
        if last_pir is None or last_pir != funhouse.peripherals.pir_sensor:
            last_pir = funhouse.peripherals.pir_sensor
            funhouse.network.mqtt_publish("pir", "%d" % last_pir)
        funhouse.peripherals.led = False

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Re: Funhouse LCD

by dastels on Sun May 16, 2021 8:45 pm

Not even right after reset, before the CircuitPython code is up & running?

After looking at the funhouse library and trying some experiments, it seems that he screen is blanked as part of instantiating the Funhouse class.

Dave

dastels
 
Posts: 6475
Joined: Tue Oct 20, 2015 3:22 pm

Re: Funhouse LCD

by Powderjockey on Sun May 16, 2021 9:00 pm

I get nothing, not even a flash of back lighting. Reset the board back to the beginning and reinstalled the UF2 file (6.2), nothing during the reinstall, then code.py loaded and still nothing. Code up and running and nothing.

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Re: Funhouse LCD

by Powderjockey on Tue Jun 01, 2021 7:52 pm

I've played with this board off and on since I received it and I can't seem to get the screen function at all. Current code is noted below.

Code: Select all | TOGGLE FULL SIZE
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import board
from digitalio import DigitalInOut, Direction, Pull
from adafruit_funhouse import FunHouse

funhouse = FunHouse(
    default_bg=0x0F0F00,
    scale=2,
)

funhouse.peripherals.set_dotstars(0x800000, 0x808000, 0x008000, 0x000080, 0x800080)

# sensor setup
sensors = []
for p in (board.A0, board.A1, board.A2):
    sensor = DigitalInOut(p)
    sensor.direction = Direction.INPUT
    sensor.pull = Pull.DOWN
    sensors.append(sensor)


def set_label_color(conditional, index, on_color):
    if conditional:
        funhouse.set_text_color(on_color, index)
    else:
        funhouse.set_text_color(0x606060, index)


# Create the labels
funhouse.display.show(None)
slider_label = funhouse.add_text(
    text="Slider:", text_position=(50, 30), text_color=0x606060
)
capright_label = funhouse.add_text(
    text="Touch", text_position=(85, 10), text_color=0x606060
)
pir_label = funhouse.add_text(text="PIR", text_position=(60, 10), text_color=0x606060)
capleft_label = funhouse.add_text(
    text="Touch", text_position=(25, 10), text_color=0x606060
)
onoff_label = funhouse.add_text(text="OFF", text_position=(10, 25), text_color=0x606060)
up_label = funhouse.add_text(text="UP", text_position=(10, 10), text_color=0x606060)
sel_label = funhouse.add_text(text="SEL", text_position=(10, 60), text_color=0x606060)
down_label = funhouse.add_text(
    text="DOWN", text_position=(10, 100), text_color=0x606060
)
jst1_label = funhouse.add_text(
    text="SENSOR 1", text_position=(40, 80), text_color=0x606060
)
jst2_label = funhouse.add_text(
    text="SENSOR 2", text_position=(40, 95), text_color=0x606060
)
jst3_label = funhouse.add_text(
    text="SENSOR 3", text_position=(40, 110), text_color=0x606060
)
temp_label = funhouse.add_text(
    text="Temp:", text_position=(50, 45), text_color=0xFF00FF
)
pres_label = funhouse.add_text(
    text="Pres:", text_position=(50, 60), text_color=0xFF00FF
)
funhouse.display.show(funhouse.splash)

while True:
    funhouse.set_text("Temp %0.1F" % funhouse.peripherals.temperature, temp_label)
    funhouse.set_text("Pres %d" % funhouse.peripherals.pressure, pres_label)

    print(funhouse.peripherals.temperature, funhouse.peripherals.relative_humidity)
    set_label_color(funhouse.peripherals.captouch6, onoff_label, 0x00FF00)
    set_label_color(funhouse.peripherals.captouch7, capleft_label, 0x00FF00)
    set_label_color(funhouse.peripherals.captouch8, capright_label, 0x00FF00)

    slider = funhouse.peripherals.slider
    if slider is not None:
        funhouse.peripherals.dotstars.brightness = slider
        funhouse.set_text("Slider: %1.1f" % slider, slider_label)
    set_label_color(slider is not None, slider_label, 0xFFFF00)

    set_label_color(funhouse.peripherals.button_up, up_label, 0xFF0000)
    set_label_color(funhouse.peripherals.button_sel, sel_label, 0xFFFF00)
    set_label_color(funhouse.peripherals.button_down, down_label, 0x00FF00)

    set_label_color(funhouse.peripherals.pir_sensor, pir_label, 0xFF0000)
    set_label_color(sensors[0].value, jst1_label, 0xFFFFFF)
    set_label_color(sensors[1].value, jst2_label, 0xFFFFFF)
    set_label_color(sensors[2].value, jst3_label, 0xFFFFFF)

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Re: Funhouse LCD

by tannewt on Tue Jun 01, 2021 8:03 pm

Please post pictures of the front and back of your board. The display may not be working if the ribbon cable isn't seated correctly.

tannewt
 
Posts: 2428
Joined: Thu Oct 06, 2016 8:48 pm

Re: Funhouse LCD

by Powderjockey on Tue Jun 01, 2021 10:23 pm

Sure, just when I re-plug in the Funhouse, it is working. Have the mail delivery code running and it is updating the IO as well.

I'll try a couple of other codes and see if there is some output.

Thanks.

Powderjockey
 
Posts: 152
Joined: Fri Mar 31, 2017 10:14 pm

Please be positive and constructive with your questions and comments.