This is a Python 3 library for easily setting up devices connected to a Raspberry Pi. It contains objects and methods for DC motors with and without software PWM, servos and LEDs.
Currently, following objects are available:
SimpleMotor: DC Motor with bi-directional rotation (no PWM control)
DCMotor: DC Motor with bi-directional rotation and PWM control methods
Servo: Servo with PWM control and configuration methods
LED: LED, Laser Diode or any other device which can be controlled using a single GPIO output pin
Installation and Usage
Option 1 (Recommended) :
Using pip:
sudo pip install rpi_devices
or using setuptools:
git clone https://github.com/munircontractor/raspberry-pi-device-library cd raspberry-pi-device-library sudo python3 setup.py install
Then, in your code:
from rpi_devices import cleanup, <Device>
Option 2 :
Using directly:
Copy the rpi_devices/devices.py files to your Raspberry Pi.
To use the objects, add the following lines at the top of your code:
import sys sys.path.append("/full/path/to/devices.py") from devices import cleanup, <Device>-
Cautions
Do not forget to run the library’s cleanup function or RPi.GPIO.cleanup() after you are done.
Although all the classes in this library allow a different pin numbering mode during setup, it is strongly recommended to use the same mode across all devices. The pin numbering mode is set globally, so if devices are set with different pin numbering modes, code which is not calling a device method will automatically use the mode of the last device called, which can lead to undesirable and, at times, harmful behavior.
Release files for rpi-devices 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rpi_devices-0.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rpi_devices-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / rpi_devices-0.1.0.tar.gz
| Download URL | rpi_devices-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e0fc1cfed9d45280683643fad54bdde1dfa843166cc12569efa5b51aa90f566
|
|
BLAKE2b-256 checksum How to use checksums |
832cbee0bffe017fd1ff6ec1075493e645277d720120bf7f56c03e95c9a3cb5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / rpi_devices-0.1.0-py3-none-any.whl
| Download URL | rpi_devices-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13ef31bcdd998f4ac427b84ec8a2afdddf262ce1eeb4e6bc009a815e0fa5e55a
|
|
BLAKE2b-256 checksum How to use checksums |
993f97debfc4a41c3a42e68ead427f6ec0f6169d611376e938f61277b937f97f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |