https://github.com/voidpp/rpi-gpio-http
HTTP interface for Raspberry Pi GPIO
https://github.com/voidpp/rpi-gpio-http
Last synced: 5 months ago
JSON representation
HTTP interface for Raspberry Pi GPIO
- Host: GitHub
- URL: https://github.com/voidpp/rpi-gpio-http
- Owner: voidpp
- License: mit
- Created: 2016-01-20T22:10:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-11-03T22:21:14.000Z (over 6 years ago)
- Last Synced: 2025-09-16T07:38:32.144Z (9 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
About
------
This is a REST api for GPIO ports in Raspberry P.
REST api
--------
**Format**:
+ request: "application/x-www-form-urlencoded"
+ response: json
**Endpoints**:
+ ``GET /channel`` *List of all enabled channels, and their values*
+ ``PUT /channel`` *Set values* Example: ``pin[11]=100&pin[13]=100&pin[15]=100``
+ ``GET /channel/10`` *Get the value of the 10th channel*
+ ``PUT /channel/10`` *Set the value of the 10th channel. Not available for "input". PWM: [0, 100]. Output: [0, 1]* Example: ``value=10``
Config
------
See example configuration. (rpi-gpio-http-config.example.json) It contains all the available channel types.
Type config:
+ **output**: none
+ **input**: pull: up|down: see http://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/
+ **pwm**: frequency: in Hz
*Note: pin numbers is the physical number in the board*
Install
-------
``pip install rpi-gpio-http``
Do not use the ``run-dev-server.py`` in 'production', instead of this use [uWSGI](https://uwsgi-docs.readthedocs.org/en/latest/), or sg else.
Example config for uwsgi:
```ini
[uwsgi]
processes = 2
module = rpi_gpio_http.app:app
http-socket = :53042
uid = root
gid = root
```