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
- Host: GitHub
- URL: https://github.com/abaker/gpio_httpd
- Owner: abaker
- Created: 2019-08-20T21:03:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T22:12:55.000Z (over 4 years ago)
- Last Synced: 2025-01-20T06:18:57.797Z (about 1 year ago)
- Topics: gpio-pins, raspberry-pi
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```