Skip to content

A python library to control a MAX7301. It uses spidev to talk to the chip via SPI.

License

Notifications You must be signed in to change notification settings

OroraTech/py-max7301

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MAX7301 GPIO Expander

A python library to control a MAX7301. It uses spidev to talk to the chip via SPI.

Example

from .py_max7301 import py_max7301
device = py_max7301.MAX7301(spi_dev=1) # Select the correct spi device
device.set_pin_as_output(7) # Set pin 7 as output
device.set_pin(7, 1) # Set to high

========== Original README: ==========

max7301

A python library to control a MAX7301. It uses spidev to talk to the chip.

Installation on Raspberry Pi

  1. sudo pip install max7301
  2. sudo py-max7301-rpi-spi-setup
  3. reboot
  4. PROFIT

Example

import max7301
import time

device = max7301.MAX7301()

device.set_pin_as_output(30)
device.set_pin_as_input(31, pullup = False)

while 1:
    device.set_pin(30, 1)
    time.sleep(0.1)
    print "Pin 31 =", device.get_pin(31)
    device.set_pin(30, 0)
    time.sleep(0.1)
    print "Pin 31 =", device.get_pin(31)

About

A python library to control a MAX7301. It uses spidev to talk to the chip via SPI.

Resources

License

Stars

Watchers

Forks

Languages

  • Python 91.9%
  • Shell 8.1%