Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
This adds basic support for writing to digital pins on the
Raspberry PI. This should work out of the box on Raspbian, as it
comes pre-loaded with `RPi.GPIO`, which is the Python library for
interacting with the GPIO pins on the Raspberry Pi.
  • Loading branch information
kevin-brown committed Jul 15, 2015
0 parents commit cac1790
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Created by https://www.gitignore.io

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
1 change: 1 addition & 0 deletions zorg_raspi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .adaptor import RasPi
15 changes: 15 additions & 0 deletions zorg_raspi/adaptor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from zorg.adaptor import Adaptor
from RPi import GPIO


class RasPi(Adaptor):

def __init__(self, options):
super(RasPi, self).__init__(options)

GPIO.setmode(GPIO.BOARD)

def digital_write(self, pin_number, value):
GPIO.setup(pin_number, GPIO.OUT)

GPIO.output(pin_number, value)

0 comments on commit cac1790

Please sign in to comment.