EasyAsPi
This project aims to remove a lot of the complexity of dealing with the GPIO and PiCamera for beginner level programmers working with the Raspberry Pi.
This project has been initially developed for use within my own classes that I teach but I hope it might find use for others too.
PROJECT HOME
GETTING STARTED
This assumes you have a Raspberry Pi (and a PiCamera to use that functionality). All code tested on Raspberry Pi model 3, PiCamera model 2, running Raspbian 2018-06-29.
INSTALL
pip install easyaspi
USAGE
At present, the project supports LEDs, buttons, ultrasonics and the PiCamera. This list of tools is expected to grow as need arises.
Note: This library will set the default GPIO pin layout mode to BCM.
LEDs
- Create the LED object
import easyaspi
led = easyaspi.LED( pin_number )
- Turn an LED on
led.set(True)
- Turn an LED off
led.set(False)
BUTTONs
- Create the Button object
import easyaspi
button = easyaspi.Button( pin_number )
- Retrieve if the button is being pressed
button_state = button.get()
- Set an event callback for button presses
# Note: The function definition for the callback requires the state parameter even though it should always be set to True to indicate the button is currently pressed.
def was_pressed(state):
print("Button was pressed!")
button.on_press(was_pressed)
- Remove an event callback
button.remove_on_press() # Remove any event listener for this button
ULTRASONIC
- Create the Ultrasonic variable
import easyaspi
ultra = easyaspi.Ultrasonic( trigger_pin_number, echo_pin_number )
- Retrieve the distance in centimeters
distance = ultra.get_distance()
PICAMERA
- Create the Camera object
import easyaspi
camera = easyaspi.Camera()
- Take a photo (without a message)
camera.photo("myphoto.png")
- Take a photo (with a message)
camera.photo("myphoto.png", "my message")
- Start video recording
camera.record("myvideo.h264", "my message")
- Check to see if camera is recording video
recording_state = camera.recording # Returns True or False
- Stop video recording
camera.stop()
- Close the camera preview window when finished
camera.preview(False)
AUTHOR
LICENSE
MIT License (C) 2018 Paul Baumgarten
Metadata
Release files for easyaspi 2018.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easyaspi-2018.3.tar.gz | 3.6 kB | Without provenance | Details for easyaspi-2018.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easyaspi-2018.3-py3-none-any.whl | Python 3 | none | any | Details for easyaspi-2018.3-py3-none-any.whl |
Total release size: 8.0 kB
Release files / easyaspi-2018.3.tar.gz
| Download URL | easyaspi-2018.3.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccc2b90355e861e242d4df79e188583255b5a3a4b0bae1644a53be5042e70838
|
|
BLAKE2b-256 checksum How to use checksums |
247f298c6f547304310b93608c7daa2660ee6f92252cd6c465c8b71a76b8f3b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|
Release files / easyaspi-2018.3-py3-none-any.whl
| Download URL | easyaspi-2018.3-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f3c3febf636318554f313d14c3a443176e00c390e2e0214405456d50d8b0f6c
|
|
BLAKE2b-256 checksum How to use checksums |
65589eca43a173358826c6eb1a51883b7c220b5bb1443f011432103edff229fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|
Security for easyaspi 2018.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.