Coder Social home page Coder Social logo

ororatech / py-max7301 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from muccc/py-max7301

1.0 0.0 0.0 18 KB

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

License: GNU General Public License v3.0

Shell 8.13% Python 91.87%

py-max7301's Introduction

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)

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.