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.0.tar.gz
.
File metadata
- Download URL: remoteio-2.0.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 | 19f3c0862b06c4ed1b0fd80ee44c237ab7d5c99347b2128041cefc852fc909a9 |
|
MD5 | 6c8dfc93fa37c3fa77eb4c859a29f5b8 |
|
BLAKE2b-256 | 0113695dd08c7774609b9ea28f84633218021593c175926f24490491c04dbfe0 |
File details
Details for the file remoteio-2.0-py3-none-any.whl
.
File metadata
- Download URL: remoteio-2.0-py3-none-any.whl
- Upload date:
- Size: 18.6 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 | 4074a3cb2bfddda5734824b7e992f7f67e80eac536a0e92b01ac0a831ef63a5c |
|
MD5 | 21ba858e318d064a743df372f90a3552 |
|
BLAKE2b-256 | c8a60180e464d826691f78333fc15440681bd17d9481207daae7d991a44a26ee |