Coder Social home page Coder Social logo

jrendon102 / gpiozero_plus Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 58 KB

A Python Library providing enhanced features and utilities for gpiozero.

License: MIT License

Python 100.00%
python3 mobile-robotics raspberry-pi-4 yahboom gpiozero-library pigpio-library robotics-programming

gpiozero_plus's Introduction

gpiozero_plus

License

A Python Library providing enhanced features and utilities for gpiozero.

This library is a Python wrapper designed to simplify the setup and control of components using the gpiozero library. It provides a convenient interface for managing various hardware components when working with Raspberry Pi, making it easier to interact with GPIO pins. It is a versatile tool for anyone looking to streamline the control of hardware components in Python applications.

Dependencies

This library relies on the following dependencies:

  • gpiozero: A Python library for controlling GPIO pins on Raspberry Pi and other supported platforms.

  • pigpio: A library for interfacing with the GPIO pins on the Raspberry Pi. It is required for certain functionality in this library.

Installation

You can install the gpiozero plus library using pip. If you haven't already, make sure you have Python and pip installed on your system.

  1. Clone the Repository: Clone the gpiozero plus repository to your local machine.

    git clone https://github.com/jrendon102/gpiozero_plus.git
  2. Navigate to the Project Directory: Go to the directory where you cloned the repository.

    cd gpiozero_plus
  3. Install the Package: Use pip to install the package after building it using the provided setup script.

    First, build the package:

    python3 setup.py sdist

    Next, use pip to install the package from the generated distribution:

    pip install .
    

    Finally, verify that the package was installed successfully.

    pip list | grep gpiozero_plus

To install pigpio library follow these steps:

  1. Navigate to opt/ directory

    cd /opt
  2. Download the lastes version of pigpio:

    sudo wget https://github.com/joan2937/pigpio/archive/master.zip
  3. Unzip the downloaded archive and remove it

    sudo unzip master.zip && sudo rm master.zip
  4. Change to the pigpio-master direcotry:

    cd pigpio-master
  5. Build and install pigpio:

    sudo make
    sudo make install

After completing these steps, you should have pigpio installed and ready for use.

Uninstall

You can uninstall the gpiozero_plus using the following command:

pip uninstall gpiozero_plus

Example

Here's an example of how to use the gpiozero_plus library in your Python project:

  1. Start the pigpio daemon by running the following command:

    sudo pigpiod
  2. Create a script called my_fan.py with the following code:

    #!/usr/bin/env python3
    import time
    from gpiozero_plus import Fan
    
    # Initialize and use the various components from the library
    fan = Fan(fan_pin=2)
    
    try:
        # Turn fan on for 5 seconds
        print("Turning fan on for 5 seconds")
        fan.control_fan(fan_enable=True)
        time.sleep(5)
    
        # Turn fan on off 5 seconds
        print("Turning fan off for 5 seconds")
        fan.control_fan(fan_enable=False)
        time.sleep(5)
    
    # Catch Keyboard interrupt to prevent motor from continuing to
    # operate if 5 seconds have not elapsed.
    except KeyboardInterrupt:
        print("Keyboard interrupt received.")
    
    # Make sure to release the GPIO pin(s)
    fan.disconnect()
  3. Finally run the command python3 my_fan.py to see the fan in action.

More Information

For more information about pigpio, you can visit the official website.

Information about the pigpio Daemon can be found in the official website.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author & Maintainer

Julian Rendon

Email: [email protected]

gpiozero_plus's People

Contributors

jrendon102 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.