gwillz / shiftpi

ShiftPi is the easiest way to work with 74HC595 shift registers on your Raspberry Pi in Arduino style :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShiftPi

build status coverage report

ShiftPi is the easiest way to work with 74HC595 shift registers on your Raspberry Pi. This is a fork of Mignev's Arduino style library. Which in turn was inspired by this article: Can you move over? The 74HC595 8 bit shift register

How to connect a Pi to a 74HC595

Scheme

Usage

import shiftpi

s = shiftpi.ShiftPi()

# set pin-1 on
s.write(0, True)
# or
s.write(0, s.HIGH)
# or
s.up(0)

# set all on (or off)
s.write(s.ALL, True)

# set pin-8 off
s.write(7, False)
# or
s.down(0)

API stuff

Constants

  • HIGH - pin on
  • LOW - pin off
  • ALL - all pins (instead of 0-7)

Init (s = ShiftPi())

Default pins mappings are as follows:

Name GPIO 74HC959
SER 27 14
RCLK 24 12
SRCLK 22 11

Different pins can be set with the init options. Additional chips can be set here too.

s = ShiftPi(ser_pin=27, rck_pin=24, sck_pin=22, num_registers=2)

Requirements

  • Raspberry Pi
  • Python 2.7+

Installation

ShiftPi uses PyGPIO to expose multiple backends. By default it uses a native interface to the linux GPIO driver. It can also utilise RPi.GPIO or WiringPi.

Get shiftpi source and install it:

git clone https://git.mk2es.com.au/gwillz/shiftpi
cd shiftpi/
sudo python setup.py install

Contributors

Useful links

Copyright

See LICENSE

About

ShiftPi is the easiest way to work with 74HC595 shift registers on your Raspberry Pi in Arduino style :)

License:MIT License


Languages

Language:Python 100.0%