metachris / raspberrypi-utils

Collection of utilities for the Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python tools to simplify working with the Raspberry Pi and it's GPIO port. All source code in this repository is released under the MIT license.

RPIO

Extension of RPi.GPIO which can handle interrupts. Works with Python 2.x and 3.x. The easiest way to install RPIO is via pip or easy_install:

sudo easy_install -U RPIO

This project has a new home: https://github.com/metachris/RPIO

gpiodaemon.py

Socket daemon which can handle scheduled task management (run a command in seconds, eg. to turn something off after a certain amount of time), and accepts user defined commands (eg. led on instead of set 17 HIGH). Custom commands and pin setup are defined in config.yaml. The deamon listens on port 9101. Requires the tornado and pyyaml.

rpi_detect_model.py

Detects a Raspberry's model and manufacturer, and makes the attributes easily accessible.

sdbackup.sh

Backup boot and root partition of a linux SD card into .tar files.

Interrupts

Interrupts can be used to receive notifications from the kernel when GPIO state changes occur. This has the advantages of requiring almost zero cpu consumption and very fast notification times, as well as allowing to easily monitor specific transitions via edge='rising|falling|both'. Here is an example:

import RPIO

def do_something(gpio_id, value):
    print("New value for GPIO %s: %s" % (gpio_id, value))

RPIO.add_interrupt_callback(17, do_something, edge='rising')
RPIO.add_interrupt_callback(18, do_something, edge='falling')
RPIO.add_interrupt_callback(19, do_something, edge='both')
RPIO.wait_for_interrupts()

Links

Feedback

Chris Hager (chris@linuxuser.at)

About

Collection of utilities for the Raspberry Pi

License:MIT License


Languages

Language:Python 77.1%Language:Shell 22.9%