adafruit-circuitpython-funhouse


Nameadafruit-circuitpython-funhouse JSON
Version 2.2.3 PyPI version JSON
download
home_pageNone
SummaryHelper library for the FunHouse board
upload_time2024-10-07 22:30:45
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords adafruit funhouse microcontroller sensors hardware micropythoncircuitpython
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============


.. image:: https://readthedocs.org/projects/adafruit-circuitpython-funhouse/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/funhouse/en/latest/
    :alt: Documentation Status


.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord


.. image:: https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/actions
    :alt: Build Status


.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

Helper library for the Adafruit FunHouse board


Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Adafruit CircuitPython AHTx0 <https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/>`_
* `Adafruit CircuitPython Connection Manager <https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/>`_
* `Adafruit CircuitPython DotStar <https://github.com/adafruit/Adafruit_CircuitPython_DotStar/>`_
* `Adafruit CircuitPython DPS310 <https://github.com/adafruit/Adafruit_CircuitPython_DPS310/>`_
* `Adafruit CircuitPython MiniMQTT <https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/>`_
* `Adafruit CircuitPython PortalBase <https://github.com/adafruit/Adafruit_CircuitPython_PortalBase/>`_
* `Adafruit CircuitPython Requests <https://github.com/adafruit/Adafruit_CircuitPython_Requests/>`_
* `Adafruit CircuitPython SimpleIO <https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO/>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
or individual libraries can be installed using
`circup <https://github.com/adafruit/circup>`_.

Adafruit FunHouse Home Automation board

`Purchase one from the Adafruit shop <http://www.adafruit.com/products/4985>`_


Usage Example
=============

.. code:: python

    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.splash

    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 <https://docs.circuitpython.org/projects/funhouse/en/latest/>`_.

For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "adafruit-circuitpython-funhouse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "adafruit, funhouse, microcontroller, sensors, hardware, micropythoncircuitpython",
    "author": null,
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/86/f16e9d735ee8cfb23015fb0c56f08f4813e80d321c09ee8b76393c25542f/adafruit_circuitpython_funhouse-2.2.3.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-funhouse/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/funhouse/en/latest/\n    :alt: Documentation Status\n\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/actions\n    :alt: Build Status\n\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nHelper library for the Adafruit FunHouse board\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n* `Adafruit CircuitPython AHTx0 <https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/>`_\n* `Adafruit CircuitPython Connection Manager <https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/>`_\n* `Adafruit CircuitPython DotStar <https://github.com/adafruit/Adafruit_CircuitPython_DotStar/>`_\n* `Adafruit CircuitPython DPS310 <https://github.com/adafruit/Adafruit_CircuitPython_DPS310/>`_\n* `Adafruit CircuitPython MiniMQTT <https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/>`_\n* `Adafruit CircuitPython PortalBase <https://github.com/adafruit/Adafruit_CircuitPython_PortalBase/>`_\n* `Adafruit CircuitPython Requests <https://github.com/adafruit/Adafruit_CircuitPython_Requests/>`_\n* `Adafruit CircuitPython SimpleIO <https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO/>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_\nor individual libraries can be installed using\n`circup <https://github.com/adafruit/circup>`_.\n\nAdafruit FunHouse Home Automation board\n\n`Purchase one from the Adafruit shop <http://www.adafruit.com/products/4985>`_\n\n\nUsage Example\n=============\n\n.. code:: python\n\n    import board\n    from digitalio import DigitalInOut, Direction, Pull\n    import adafruit_dps310\n    import adafruit_ahtx0\n    from adafruit_funhouse import FunHouse\n\n    funhouse = FunHouse(\n        default_bg=0x0F0F00,\n        scale=2,\n    )\n\n    i2c = board.I2C()\n    dps310 = adafruit_dps310.DPS310(i2c)\n    aht20 = adafruit_ahtx0.AHTx0(i2c)\n\n    funhouse.peripherals.set_dotstars(0x800000, 0x808000, 0x008000, 0x000080, 0x800080)\n\n    # sensor setup\n    sensors = []\n    for p in (board.A0, board.A1, board.A2):\n        sensor = DigitalInOut(p)\n        sensor.direction = Direction.INPUT\n        sensor.pull = Pull.DOWN\n        sensors.append(sensor)\n\n\n    def set_label_color(conditional, index, on_color):\n        if conditional:\n            funhouse.set_text_color(on_color, index)\n        else:\n            funhouse.set_text_color(0x606060, index)\n\n\n    # Create the labels\n    funhouse.display.root_group = None\n    slider_label = funhouse.add_text(\n        text=\"Slider:\", text_position=(50, 30), text_color=0x606060\n    )\n    capright_label = funhouse.add_text(\n        text=\"Touch\", text_position=(85, 10), text_color=0x606060\n    )\n    pir_label = funhouse.add_text(text=\"PIR\", text_position=(60, 10), text_color=0x606060)\n    capleft_label = funhouse.add_text(\n        text=\"Touch\", text_position=(25, 10), text_color=0x606060\n    )\n    onoff_label = funhouse.add_text(text=\"OFF\", text_position=(10, 25), text_color=0x606060)\n    up_label = funhouse.add_text(text=\"UP\", text_position=(10, 10), text_color=0x606060)\n    sel_label = funhouse.add_text(text=\"SEL\", text_position=(10, 60), text_color=0x606060)\n    down_label = funhouse.add_text(\n        text=\"DOWN\", text_position=(10, 100), text_color=0x606060\n    )\n    jst1_label = funhouse.add_text(\n        text=\"SENSOR 1\", text_position=(40, 80), text_color=0x606060\n    )\n    jst2_label = funhouse.add_text(\n        text=\"SENSOR 2\", text_position=(40, 95), text_color=0x606060\n    )\n    jst3_label = funhouse.add_text(\n        text=\"SENSOR 3\", text_position=(40, 110), text_color=0x606060\n    )\n    temp_label = funhouse.add_text(\n        text=\"Temp:\", text_position=(50, 45), text_color=0xFF00FF\n    )\n    pres_label = funhouse.add_text(\n        text=\"Pres:\", text_position=(50, 60), text_color=0xFF00FF\n    )\n    funhouse.display.root_group = funhouse.splash\n\n    while True:\n        funhouse.set_text(\"Temp %0.1F\" % dps310.temperature, temp_label)\n        funhouse.set_text(\"Pres %d\" % dps310.pressure, pres_label)\n\n        print(aht20.temperature, aht20.relative_humidity)\n        set_label_color(funhouse.peripherals.captouch6, onoff_label, 0x00FF00)\n        set_label_color(funhouse.peripherals.captouch7, capleft_label, 0x00FF00)\n        set_label_color(funhouse.peripherals.captouch8, capright_label, 0x00FF00)\n\n        slider = funhouse.peripherals.slider\n        if slider is not None:\n            funhouse.peripherals.dotstars.brightness = slider\n            funhouse.set_text(\"Slider: %1.1f\" % slider, slider_label)\n        set_label_color(slider is not None, slider_label, 0xFFFF00)\n\n        set_label_color(funhouse.peripherals.button_up, up_label, 0xFF0000)\n        set_label_color(funhouse.peripherals.button_sel, sel_label, 0xFFFF00)\n        set_label_color(funhouse.peripherals.button_down, down_label, 0x00FF00)\n\n        set_label_color(funhouse.peripherals.pir_sensor, pir_label, 0xFF0000)\n        set_label_color(sensors[0].value, jst1_label, 0xFFFFFF)\n        set_label_color(sensors[1].value, jst2_label, 0xFFFFFF)\n        set_label_color(sensors[2].value, jst3_label, 0xFFFFFF)\n\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/funhouse/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Helper library for the FunHouse board",
    "version": "2.2.3",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_FunHouse"
    },
    "split_keywords": [
        "adafruit",
        " funhouse",
        " microcontroller",
        " sensors",
        " hardware",
        " micropythoncircuitpython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f0338fd1e12c67b863fbb315e4c9a862d7b394247f190a0ac482c01a579625b",
                "md5": "95cda8b2f4824eb3e5ee7fdfa3f41ff0",
                "sha256": "39ba780b849114af26d9b7307dd2645c37ed0a6449518279143a3302280ed01f"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_funhouse-2.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95cda8b2f4824eb3e5ee7fdfa3f41ff0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11396,
            "upload_time": "2024-10-07T22:30:44",
            "upload_time_iso_8601": "2024-10-07T22:30:44.365167Z",
            "url": "https://files.pythonhosted.org/packages/5f/03/38fd1e12c67b863fbb315e4c9a862d7b394247f190a0ac482c01a579625b/adafruit_circuitpython_funhouse-2.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2786f16e9d735ee8cfb23015fb0c56f08f4813e80d321c09ee8b76393c25542f",
                "md5": "bef8d848450c788e9ffb09b2a0d7e4e5",
                "sha256": "cade7ce6ecfdbcab98a6d5a0f1fcab4669820153a6693be5acca29a89e42fa80"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_funhouse-2.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "bef8d848450c788e9ffb09b2a0d7e4e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 32375,
            "upload_time": "2024-10-07T22:30:45",
            "upload_time_iso_8601": "2024-10-07T22:30:45.958450Z",
            "url": "https://files.pythonhosted.org/packages/27/86/f16e9d735ee8cfb23015fb0c56f08f4813e80d321c09ee8b76393c25542f/adafruit_circuitpython_funhouse-2.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 22:30:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_FunHouse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "adafruit-circuitpython-funhouse"
}
        
Elapsed time: 0.36393s