remoteio - Remote GPIO control
Project description
remoteio
A Raspberry Pi GPIO remote control based on gpiozero
https://github.com/gpiozero/gpiozero
new behavior of remoteio: simultaneous processing of remote pins
When remoteio proceeds 2 pins, the second pin must wait until the first one has made his work on the server. This may take time, if the first pin has a long timer and the second pin cannot start its work. A pin blocks itself in the same way. In this modification of remoteio, different pins can work simultaneously. If a pin has two tasks and the second one is asked to start before the first one has finished, the second one interrupts the first one. The main modifications are the use of
- a list of maps, that allows sending of tasks of several pins to the server
- an own thread for each pin for treating
- thread safe queues for each pin as input to the pin-specific threads
- a thread.Timer in handle_timer instead of time.sleep in order to make the interruption of a task with a time_ms>0 possible
- the getattr function to find led-funtions only by knowing the name of the function
Further, the internal pin numbering is 'b', by the aid of a conversion dictionary. This allows to suppress the establishing of the sam pin two times by different representations by 'b' and 'g' The syntax to operate the pins is the same as that of remoteio.
Server (remote Raspberry Pi)
Use this all-in-one command to install remoteio as deamon on port 8509
.
The server can be updated with this command.
bash -c "$(wget -qLO - https://github.com/schech1/remoteio/raw/master/install.sh)"
Using pip
pip install remoteio
When you want to create the server by yourself, you can install the library via pip and use the examples below, for server- and client usage.
Server usage
Start a remote server on port 1234
.
If no port is specified default port 8509
will be used
from remoteio import run_server
if __name__ == "__main__":
run_server(port=1234)
Client usage
from remoteio import RemoteServer
if __name__ == "__main__":
server_ip = "192.168.1.38"
server_port = 1234
remote_server = RemoteServer(server_ip, server_port)
remote_pin = remote_server.pin(7, 'b')
remote_pin.on(time_ms=2000) # (Optional) Time until switch off
remote_pin.blink() # Blink LED
remote_pin.pulse() # Pulse LED
remote_pin.off()
remote_server.close()
Use Board numbering
remote_pin = remote_server.pin(7, 'b') # Use physical board numbering
Use GPIO numbering
remote_pin = remote_server.pin(4, 'g') # Use GPIO numbering (e.g. GPIO4)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file remoteio-2.1.tar.gz
.
File metadata
- Download URL: remoteio-2.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70e7c0a53ff8b52c6b89413f8b27a7d1313bc7aaacbac07c9f814c5d522a2e7e |
|
MD5 | 1da59cccc6812fe587959385c5fe5cad |
|
BLAKE2b-256 | 7aa6186432bdb7a8830232923ade5a72614d3acf84832e0273412757c765d8c3 |
File details
Details for the file remoteio-2.1-py3-none-any.whl
.
File metadata
- Download URL: remoteio-2.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b977ada040adb98ca063d2625782a6830e839cdcd8e9377298a94b6a20f02ba9 |
|
MD5 | 156ff9ae222952a65525cd377a28c5d5 |
|
BLAKE2b-256 | 8f0a7db880518ea61eccec732e937ca3e2552cb73bd026166892d39ba8d2694c |