An open API service indexing awesome lists of open source software.

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

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
```