Introduction
Helper library for the Adafruit FunHouse board
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Adafruit FunHouse Home Automation board
Usage Example
import board
from digitalio import DigitalInOut, Direction, Pull
import adafruit_dps310
import adafruit_ahtx0
from adafruit_funhouse import FunHouse
funhouse = FunHouse(
default_bg=0x0F0F00,
scale=2,
)
i2c = board.I2C()
dps310 = adafruit_dps310.DPS310(i2c)
aht20 = adafruit_ahtx0.AHTx0(i2c)
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.root_group = 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.root_group = funhouse.root_group
while True:
funhouse.set_text("Temp %0.1F" % dps310.temperature, temp_label)
funhouse.set_text("Pres %d" % dps310.pressure, pres_label)
print(aht20.temperature, aht20.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)
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Metadata
Release files for adafruit-circuitpython-funhouse 2.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| adafruit_circuitpython_funhouse-2.4.4.tar.gz | 29.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adafruit_circuitpython_funhouse-2.4.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / adafruit_circuitpython_funhouse-2.4.4.tar.gz
| Download URL | adafruit_circuitpython_funhouse-2.4.4.tar.gz |
|---|---|
| Size | 29.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
864a63f4b8b29d84cfb1f62e158281b9b243b5bebbce8c8526c8470276f85e58
|
|
BLAKE2b-256 checksum How to use checksums |
e9e2827c8b85670c068ac0c24aa8f5ff51e9ea3686880fad9bea20669ce42813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / adafruit_circuitpython_funhouse-2.4.4-py3-none-any.whl
| Download URL | adafruit_circuitpython_funhouse-2.4.4-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2963fd24cec746306c4be1e29f6dced6b4b4f7b89eb43283d2df07d82cda26f
|
|
BLAKE2b-256 checksum How to use checksums |
18a8c92c2c7ce93a0efa1098027d7df74a6916167cbe6d4b53ca28c6659b9c36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|