Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-dash_display/badge/?version=latest
:target: https://docs.circuitpython.org/projects/dash_display/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_Dash_Display/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/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
CircuitPython library for creating Adafruit IO dashboards.
Dependencies
=============
This driver depends on:
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
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>`_.
Usage Example
=============
.. code :: python3
import time
import ssl
import board
from digitalio import DigitalInOut, Direction, Pull
import touchio
import socketpool
import wifi
import adafruit_minimqtt.adafruit_minimqtt as MQTT
from adafruit_io.adafruit_io import IO_MQTT
from adafruit_dash_display import Hub
up = DigitalInOut(board.BUTTON_UP)
up.direction = Direction.INPUT
up.pull = Pull.DOWN
select = DigitalInOut(board.BUTTON_SELECT)
select.direction = Direction.INPUT
select.pull = Pull.DOWN
down = DigitalInOut(board.BUTTON_DOWN)
down.direction = Direction.INPUT
down.pull = Pull.DOWN
back = touchio.TouchIn(board.CAP7)
submit = touchio.TouchIn(board.CAP8)
try:
from secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
display = board.DISPLAY
# Set your Adafruit IO Username and Key in secrets.py
# (visit io.adafruit.com if you need to create an account,
# or if you need your Adafruit IO key.)
aio_username = secrets["aio_username"]
aio_key = secrets["aio_key"]
print("Connecting to %s" % secrets["ssid"])
wifi.radio.connect(secrets["ssid"], secrets["password"])
print("Connected to %s!" % secrets["ssid"])
# Create a socket pool
pool = socketpool.SocketPool(wifi.radio)
# Initialize a new MQTT Client object
mqtt_client = MQTT.MQTT(
broker="io.adafruit.com",
username=secrets["aio_username"],
password=secrets["aio_key"],
socket_pool=pool,
ssl_context=ssl.create_default_context(),
)
# Initialize an Adafruit IO MQTT Client
io = IO_MQTT(mqtt_client)
def pub_lamp(lamp):
if type(lamp) == str:
lamp = eval(lamp) # pylint: disable=eval-used
iot.publish("lamp", str(not lamp))
# funhouse.set_text(f"Lamp: {not lamp}", 0)
time.sleep(0.3)
iot = Hub(display=display, io=io, nav=(up, select, down, back, submit))
iot.add_device(
feed_key="lamp",
default_text="Lamp: ",
formatted_text="Lamp: {}",
pub_method=pub_lamp,
)
iot.add_device(
feed_key="temperature",
default_text="Temperature: ",
formatted_text="Temperature: {:.1f} C",
)
iot.add_device(
feed_key="humidity", default_text="Humidity: ", formatted_text="Humidity: {:.2f}%"
)
iot.get()
while True:
iot.loop()
time.sleep(0.01)
Documentation
=============
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/dash_display/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_Dash_Display/blob/HEAD/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Raw data
{
"_id": null,
"home_page": "",
"name": "adafruit-circuitpython-dash-display",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adafruit,displays,iot,adafruitio,hardware,micropythoncircuitpython",
"author": "",
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/c7/01/85e5ccbdb9e2e5bc19c316f07da5da804d10dab833878ac9a3ee5a8eebac/adafruit-circuitpython-dash-display-2.1.1.tar.gz",
"platform": null,
"description": "Introduction\n============\n\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-dash_display/badge/?version=latest\n :target: https://docs.circuitpython.org/projects/dash_display/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_Dash_Display/workflows/Build%20CI/badge.svg\n :target: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/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\nCircuitPython library for creating Adafruit IO dashboards.\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\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\n\nUsage Example\n=============\n\n.. code :: python3\n\n import time\n import ssl\n import board\n from digitalio import DigitalInOut, Direction, Pull\n import touchio\n import socketpool\n import wifi\n import adafruit_minimqtt.adafruit_minimqtt as MQTT\n from adafruit_io.adafruit_io import IO_MQTT\n from adafruit_dash_display import Hub\n\n up = DigitalInOut(board.BUTTON_UP)\n up.direction = Direction.INPUT\n up.pull = Pull.DOWN\n\n select = DigitalInOut(board.BUTTON_SELECT)\n select.direction = Direction.INPUT\n select.pull = Pull.DOWN\n\n down = DigitalInOut(board.BUTTON_DOWN)\n down.direction = Direction.INPUT\n down.pull = Pull.DOWN\n\n back = touchio.TouchIn(board.CAP7)\n submit = touchio.TouchIn(board.CAP8)\n\n try:\n from secrets import secrets\n except ImportError:\n print(\"WiFi secrets are kept in secrets.py, please add them there!\")\n raise\n\n display = board.DISPLAY\n\n # Set your Adafruit IO Username and Key in secrets.py\n # (visit io.adafruit.com if you need to create an account,\n # or if you need your Adafruit IO key.)\n aio_username = secrets[\"aio_username\"]\n aio_key = secrets[\"aio_key\"]\n\n print(\"Connecting to %s\" % secrets[\"ssid\"])\n wifi.radio.connect(secrets[\"ssid\"], secrets[\"password\"])\n print(\"Connected to %s!\" % secrets[\"ssid\"])\n\n # Create a socket pool\n pool = socketpool.SocketPool(wifi.radio)\n\n # Initialize a new MQTT Client object\n mqtt_client = MQTT.MQTT(\n broker=\"io.adafruit.com\",\n username=secrets[\"aio_username\"],\n password=secrets[\"aio_key\"],\n socket_pool=pool,\n ssl_context=ssl.create_default_context(),\n )\n\n # Initialize an Adafruit IO MQTT Client\n io = IO_MQTT(mqtt_client)\n\n\n def pub_lamp(lamp):\n if type(lamp) == str:\n lamp = eval(lamp) # pylint: disable=eval-used\n iot.publish(\"lamp\", str(not lamp))\n # funhouse.set_text(f\"Lamp: {not lamp}\", 0)\n time.sleep(0.3)\n\n\n iot = Hub(display=display, io=io, nav=(up, select, down, back, submit))\n\n iot.add_device(\n feed_key=\"lamp\",\n default_text=\"Lamp: \",\n formatted_text=\"Lamp: {}\",\n pub_method=pub_lamp,\n )\n iot.add_device(\n feed_key=\"temperature\",\n default_text=\"Temperature: \",\n formatted_text=\"Temperature: {:.1f} C\",\n )\n iot.add_device(\n feed_key=\"humidity\", default_text=\"Humidity: \", formatted_text=\"Humidity: {:.2f}%\"\n )\n\n iot.get()\n\n while True:\n iot.loop()\n time.sleep(0.01)\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/dash_display/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_Dash_Display/blob/HEAD/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CircuitPython library for creating Adafruit IO dashboards.",
"version": "2.1.1",
"project_urls": {
"Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display"
},
"split_keywords": [
"adafruit",
"displays",
"iot",
"adafruitio",
"hardware",
"micropythoncircuitpython"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b09ede2c557e8f7ba4c703d5160fb009e6082bd1bbd99831f2eb8a515649b4fc",
"md5": "a7bb0cba0a623862aaa5d736f68e4ad9",
"sha256": "3ae6a2b0088cd0d5716e6fce214668a4618b7a3570ad45bdc6093875c40dbed5"
},
"downloads": -1,
"filename": "adafruit_circuitpython_dash_display-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a7bb0cba0a623862aaa5d736f68e4ad9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6938,
"upload_time": "2023-12-09T17:44:01",
"upload_time_iso_8601": "2023-12-09T17:44:01.931462Z",
"url": "https://files.pythonhosted.org/packages/b0/9e/de2c557e8f7ba4c703d5160fb009e6082bd1bbd99831f2eb8a515649b4fc/adafruit_circuitpython_dash_display-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c70185e5ccbdb9e2e5bc19c316f07da5da804d10dab833878ac9a3ee5a8eebac",
"md5": "6201685d4ca2ffc20c99a394896e3886",
"sha256": "e4b1a7552b0c0f23506536be5b75051d3b8db485cc4f6b6be66f6f03cb5c3f56"
},
"downloads": -1,
"filename": "adafruit-circuitpython-dash-display-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "6201685d4ca2ffc20c99a394896e3886",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 34505,
"upload_time": "2023-12-09T17:44:03",
"upload_time_iso_8601": "2023-12-09T17:44:03.869287Z",
"url": "https://files.pythonhosted.org/packages/c7/01/85e5ccbdb9e2e5bc19c316f07da5da804d10dab833878ac9a3ee5a8eebac/adafruit-circuitpython-dash-display-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-09 17:44:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adafruit",
"github_project": "Adafruit_CircuitPython_Dash_Display",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "adafruit-circuitpython-dash-display"
}