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

https://github.com/abaker/gpio_httpd

HTTP API for Raspberry Pi GPIO pins
https://github.com/abaker/gpio_httpd

gpio-pins raspberry-pi

Last synced: about 1 month ago
JSON representation

HTTP API for Raspberry Pi GPIO pins

Awesome Lists containing this project

README

          

`gpio_httpd` is a simple web server to control Raspberry Pi GPIO pins. Example use case is activating a relay

```
$ pip install -r requirements.txt
$ python gpio_httpd.py
```

Running `curl -X POST http://localhost/17/low?ms=250` will set pin 17 to GPIO.LOW for 250 milliseconds

Running `curl http://localhost/input/17` will return the result of GPIO.input(17)

### Docker

`docker run --device "/dev/gpiomem" -p "80:80" bakerba/gpio_httpd`

### Docker Compose

```
version: '3.3'

services:
gpio_httpd:
image: bakerba/gpio_httpd
container_name: gpio_httpd
devices:
- "/dev/gpiomem"
ports:
- "80:80"
```

### Usage

```
$ python gpio_httpd.py --help

usage: gpio_httpd.py [-h] [--debug] [--port PORT]

optional arguments:
-h, --help show this help message and exit
--debug enable debug logging
--port PORT port
```