RPiLEDController


NameRPiLEDController JSON
Version 0.1.7 PyPI version JSON
download
home_page
SummaryA library to control the onboard LEDs on a Raspberry Pi
upload_time2024-03-14 18:21:08
maintainer
docs_urlNone
authorPaul März
requires_python
license
keywords raspberry pi led
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RPiLEDController
This Python can be used to easily control the onboard-leds of a Raspberry Pi
Currently the following RPis are supported:
- any Raspberry Pi 4
- any Raspberry Pi 5

## Installation
To install the package, simply run the following command:
```bash
pip install RPiLEDController
```

## Usage
To use the package, simply import it and create an instance of the `RPiLEDController` class:
```python
from RPiLEDController.RPiLEDController import RPiLEDController

led_controller = RPiLEDController()
```
At the end of your code, add the following line to release the leds:
```python
led_controller.release()
```
### ALWAYS USE SUDO TO RUN THE CODE
You will get this error if you don't use sudo: `PermissionError: [Errno 13] Permission denied: '/sys/class/leds/led1/trigger'`

## Methods
The following methods are available:

### act_off
    Turns the green activity led off
### act_on
    Turns the green activity led on
### act_release
    Resets the trigger of the green activity led to "mmc0"
### act_reserve
    Sets the trigger of the green activity led to "none"
### pwr_off
    Turns the red power led off
### pwr_on
    Turns the red power led on
### pwr_release
    Resets the trigger of the red power led to "default-on"
### pwr_reserve
    Sets the trigger of the red power led to "none"
### reserve
    Sets the trigger of the red power led to "none" and the trigger of the green activity led to "none"
### release
    Resets the trigger of the red power led to "default-on" and the trigger of the green activity led to "mmc0"

## Example
```python
from RPiLEDController.RPiLEDController import RPiLEDController
import time

led_controller = RPiLEDController()

for i in range(10):
	led_controller.act_off()
	time.sleep(1)
	led_controller.pwr_on()
	time.sleep(1)
	led_controller.act_on()
	time.sleep(1)
	led_controller.pwr_off()
	time.sleep(1)

led_controller.release()
```
This code will turn the green activity led off and the red power led on. At the end of the code, the triggers of both leds will be reset to their default values.



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "RPiLEDController",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "RASPBERRY,PI,LED",
    "author": "Paul M\u00e4rz",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": "# RPiLEDController\nThis Python can be used to easily control the onboard-leds of a Raspberry Pi\nCurrently the following RPis are supported:\n- any Raspberry Pi 4\n- any Raspberry Pi 5\n\n## Installation\nTo install the package, simply run the following command:\n```bash\npip install RPiLEDController\n```\n\n## Usage\nTo use the package, simply import it and create an instance of the `RPiLEDController` class:\n```python\nfrom RPiLEDController.RPiLEDController import RPiLEDController\n\nled_controller = RPiLEDController()\n```\nAt the end of your code, add the following line to release the leds:\n```python\nled_controller.release()\n```\n### ALWAYS USE SUDO TO RUN THE CODE\nYou will get this error if you don't use sudo: `PermissionError: [Errno 13] Permission denied: '/sys/class/leds/led1/trigger'`\n\n## Methods\nThe following methods are available:\n\n### act_off\n    Turns the green activity led off\n### act_on\n    Turns the green activity led on\n### act_release\n    Resets the trigger of the green activity led to \"mmc0\"\n### act_reserve\n    Sets the trigger of the green activity led to \"none\"\n### pwr_off\n    Turns the red power led off\n### pwr_on\n    Turns the red power led on\n### pwr_release\n    Resets the trigger of the red power led to \"default-on\"\n### pwr_reserve\n    Sets the trigger of the red power led to \"none\"\n### reserve\n    Sets the trigger of the red power led to \"none\" and the trigger of the green activity led to \"none\"\n### release\n    Resets the trigger of the red power led to \"default-on\" and the trigger of the green activity led to \"mmc0\"\n\n## Example\n```python\nfrom RPiLEDController.RPiLEDController import RPiLEDController\nimport time\n\nled_controller = RPiLEDController()\n\nfor i in range(10):\n\tled_controller.act_off()\n\ttime.sleep(1)\n\tled_controller.pwr_on()\n\ttime.sleep(1)\n\tled_controller.act_on()\n\ttime.sleep(1)\n\tled_controller.pwr_off()\n\ttime.sleep(1)\n\nled_controller.release()\n```\nThis code will turn the green activity led off and the red power led on. At the end of the code, the triggers of both leds will be reset to their default values.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A library to control the onboard LEDs on a Raspberry Pi",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "raspberry",
        "pi",
        "led"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bde4855a176028e365c0d6e6e7ecc428fcf9dc6be0bdd45070465c658323827",
                "md5": "f1a11921da4e89c146a4d2d9bd958085",
                "sha256": "0dcf006d87c66b2728b2746c2929d0cbef4945f5dbe5bd9c968e7f04f8c0cd5a"
            },
            "downloads": -1,
            "filename": "RPiLEDController-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1a11921da4e89c146a4d2d9bd958085",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4243,
            "upload_time": "2024-03-14T18:21:08",
            "upload_time_iso_8601": "2024-03-14T18:21:08.039585Z",
            "url": "https://files.pythonhosted.org/packages/1b/de/4855a176028e365c0d6e6e7ecc428fcf9dc6be0bdd45070465c658323827/RPiLEDController-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 18:21:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "rpiledcontroller"
}
        
Elapsed time: 0.46333s