pyfirmata-epd


Namepyfirmata-epd JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA library to create and send image data to an ePaper display connected to a Firmata powered microcontroller. Supports both pyFirmata and pyFirmata2!
upload_time2025-01-09 11:25:26
maintainerNone
docs_urlNone
authorNone
requires_python>=2.3
licenseNone
keywords pyfirmata pyfirmata2 epaper waveshare
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyFirmata ePaper display library

A library to create and send image data to an ePaper display connected to a firmata powered microcontroller.

Supports both pyFirmata and pyFirmata2 libraries!

Library supports Python 3.0+ and should (according to `vermin`) also support Python 2.3+


## Info

Code has been tested with the Waveshare 2.9 inch black-white and red-white display.

The code should support other displays as well,
because [Waveshare provides .cpp and .h files](https://github.com/waveshareteam/e-Paper/tree/master/Arduino) for each of their displays.

Guide below should help you. If you were to run into issues after you done all the steps according to your display,
then you could make an issue if there isn't one for your display yet.


## Setting up

You cannot just use the default StandardFirmata.ino file without making changes to it for this code to work.

See [code_pieces_for_ino.md](code_pieces_for_ino.md) for the changes you need to make.


After that install either `pyFirmata2` OR `pyFirmata` library using pip.

Then you can install this library using `pip install pyfirmata-epd`


## API/Example

Here is an example code with comments to explain the API functions:

```py
# Import pyfirmata2
from pyfirmata2 import Arduino
# or import pyfirmata
# from pyfirmata import Arduino

# Imports
from pyfirmata_epd.epd import Epd
from pyfirmata_epd.paint import Paint, COLORED, UNCOLORED
from pyfirmata_epd.fonts import Font12, Font16

# Open connection to board:
board = Arduino(Arduino.AUTODETECT)
print('Started up')
# Always enable sampling!
board.samplingOn()

# Init epaper display:
epd = Epd(board)
# Wake the display up (since it will always go in sleep mode)
epd.Reset()

# To clear the display:
epd.Clear()

# To display pixels:
epd.DisplayFrame([0xFF, ..., 0xFF], [0xFF, ..., 0xFF]) # black-white data, red-white data



# To easily draw shapes and stuff:
paint = Paint([], 128, 296) # Init empty buffer with width of 128 (must be multiple of 8, since 8 pixels are in 1 byte) and height of 296
# Init another paint for red pixels
paintRed = Paint([], 128, 296)

# Clear paint
paint.Clear(UNCOLORED)
paintRed.Clear(UNCOLORED)

# Draw string
paint.DrawStringAt(24, 32, "e-Paper Demo", Font12, COLORED)

# Draw string with 'inversed background'
paintRed.DrawFilledRectangle(0, 64, 128, 82, COLORED)
paintRed.DrawStringAt(2, 66, "Hello world", Font16, UNCOLORED)

# Draw rectangle with cross
paint.DrawRectangle(8, 120, 48, 170, COLORED)
paint.DrawLine(8, 120, 48, 170, COLORED)
paint.DrawLine(48, 120, 8, 170, COLORED)

# Draw circle
paint.DrawCircle(96, 152, 30, COLORED)

# Draw filled rectangle
paintRed.DrawFilledRectangle(8, 200, 48, 250, COLORED)

# Draw filled circle
paintRed.DrawFilledCircle(96, 232, 30, COLORED)

# Display on epaper display
epd.DisplayFrame(paint.GetImage(), paintRed.GetImage())
```

The paint should look like:
![democode result](./democode_result.png)


Extra API documentation can be found on the [ReadTheDocs](https://pyfirmata-epd.readthedocs.io/en/latest/) documentation.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyfirmata-epd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=2.3",
    "maintainer_email": null,
    "keywords": "pyfirmata, pyfirmata2, epaper, waveshare",
    "author": null,
    "author_email": "Miniontoby <author@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/1b/34/ef44a0d848a9c837d2418c8a60325a753d173ad77adcb0603506a1403388/pyfirmata_epd-1.0.1.tar.gz",
    "platform": null,
    "description": "# pyFirmata ePaper display library\n\nA library to create and send image data to an ePaper display connected to a firmata powered microcontroller.\n\nSupports both pyFirmata and pyFirmata2 libraries!\n\nLibrary supports Python 3.0+ and should (according to `vermin`) also support Python 2.3+\n\n\n## Info\n\nCode has been tested with the Waveshare 2.9 inch black-white and red-white display.\n\nThe code should support other displays as well,\nbecause [Waveshare provides .cpp and .h files](https://github.com/waveshareteam/e-Paper/tree/master/Arduino) for each of their displays.\n\nGuide below should help you. If you were to run into issues after you done all the steps according to your display,\nthen you could make an issue if there isn't one for your display yet.\n\n\n## Setting up\n\nYou cannot just use the default StandardFirmata.ino file without making changes to it for this code to work.\n\nSee [code_pieces_for_ino.md](code_pieces_for_ino.md) for the changes you need to make.\n\n\nAfter that install either `pyFirmata2` OR `pyFirmata` library using pip.\n\nThen you can install this library using `pip install pyfirmata-epd`\n\n\n## API/Example\n\nHere is an example code with comments to explain the API functions:\n\n```py\n# Import pyfirmata2\nfrom pyfirmata2 import Arduino\n# or import pyfirmata\n# from pyfirmata import Arduino\n\n# Imports\nfrom pyfirmata_epd.epd import Epd\nfrom pyfirmata_epd.paint import Paint, COLORED, UNCOLORED\nfrom pyfirmata_epd.fonts import Font12, Font16\n\n# Open connection to board:\nboard = Arduino(Arduino.AUTODETECT)\nprint('Started up')\n# Always enable sampling!\nboard.samplingOn()\n\n# Init epaper display:\nepd = Epd(board)\n# Wake the display up (since it will always go in sleep mode)\nepd.Reset()\n\n# To clear the display:\nepd.Clear()\n\n# To display pixels:\nepd.DisplayFrame([0xFF, ..., 0xFF], [0xFF, ..., 0xFF]) # black-white data, red-white data\n\n\n\n# To easily draw shapes and stuff:\npaint = Paint([], 128, 296) # Init empty buffer with width of 128 (must be multiple of 8, since 8 pixels are in 1 byte) and height of 296\n# Init another paint for red pixels\npaintRed = Paint([], 128, 296)\n\n# Clear paint\npaint.Clear(UNCOLORED)\npaintRed.Clear(UNCOLORED)\n\n# Draw string\npaint.DrawStringAt(24, 32, \"e-Paper Demo\", Font12, COLORED)\n\n# Draw string with 'inversed background'\npaintRed.DrawFilledRectangle(0, 64, 128, 82, COLORED)\npaintRed.DrawStringAt(2, 66, \"Hello world\", Font16, UNCOLORED)\n\n# Draw rectangle with cross\npaint.DrawRectangle(8, 120, 48, 170, COLORED)\npaint.DrawLine(8, 120, 48, 170, COLORED)\npaint.DrawLine(48, 120, 8, 170, COLORED)\n\n# Draw circle\npaint.DrawCircle(96, 152, 30, COLORED)\n\n# Draw filled rectangle\npaintRed.DrawFilledRectangle(8, 200, 48, 250, COLORED)\n\n# Draw filled circle\npaintRed.DrawFilledCircle(96, 232, 30, COLORED)\n\n# Display on epaper display\nepd.DisplayFrame(paint.GetImage(), paintRed.GetImage())\n```\n\nThe paint should look like:\n![democode result](./democode_result.png)\n\n\nExtra API documentation can be found on the [ReadTheDocs](https://pyfirmata-epd.readthedocs.io/en/latest/) documentation.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library to create and send image data to an ePaper display connected to a Firmata powered microcontroller. Supports both pyFirmata and pyFirmata2!",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/Miniontoby/pyFirmata_epd/issues",
        "Documentation": "https://pyfirmata_epd.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/Miniontoby/pyFirmata_epd",
        "Repository": "https://github.com/Miniontoby/pyFirmata_epd.git"
    },
    "split_keywords": [
        "pyfirmata",
        " pyfirmata2",
        " epaper",
        " waveshare"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ecded66c770e6497ce45c780f9b57031e431a3744e010cd53d164a672243cded",
                "md5": "d9f228adf78c148c7ffbe544d571d93c",
                "sha256": "165cc1ee872710f8fb6eca8e2228f809b54307e2466b2b38195312ef476c6bb1"
            },
            "downloads": -1,
            "filename": "pyfirmata_epd-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9f228adf78c148c7ffbe544d571d93c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.3",
            "size": 24925,
            "upload_time": "2025-01-09T11:25:23",
            "upload_time_iso_8601": "2025-01-09T11:25:23.101170Z",
            "url": "https://files.pythonhosted.org/packages/ec/de/d66c770e6497ce45c780f9b57031e431a3744e010cd53d164a672243cded/pyfirmata_epd-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b34ef44a0d848a9c837d2418c8a60325a753d173ad77adcb0603506a1403388",
                "md5": "3a5f857e08b3cb5fe97fd4c7df2cbe8d",
                "sha256": "1fc6cabc9330bea417af6efd900ef2514603b05ad73d2eb3863c46cadf733118"
            },
            "downloads": -1,
            "filename": "pyfirmata_epd-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3a5f857e08b3cb5fe97fd4c7df2cbe8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.3",
            "size": 26240,
            "upload_time": "2025-01-09T11:25:26",
            "upload_time_iso_8601": "2025-01-09T11:25:26.719499Z",
            "url": "https://files.pythonhosted.org/packages/1b/34/ef44a0d848a9c837d2418c8a60325a753d173ad77adcb0603506a1403388/pyfirmata_epd-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-09 11:25:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Miniontoby",
    "github_project": "pyFirmata_epd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyfirmata-epd"
}
        
Elapsed time: 0.36933s