Skip to content

Commit

Permalink
Add on/off methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Hines committed Dec 29, 2014
1 parent 2cb9801 commit b5fcd0c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ v0.0.1, 2014-12-27 -- Initial release.
v0.0.2, 2014-12-27 -- Rename README.md to README.txt
v0.0.5, 2014-12-29 -- General clean up
v0.0.6, 2014-12-29 -- Trying to get this README.txt to display correctly
v0.0.7, 2014-12-29 -- Add on/off methods
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ pins = PinManager(config_file='path/to/config/file.yml')
result = pins.read(18)
# Write to a pin
result = pins.write(19, 1)
pins.write(19, 1)
# Turn pin on
pins.on(19)
# Turn pin off
pins.off(19)
# Get configuration for a pin
result = pins.get_config(23)
Expand Down
6 changes: 6 additions & 0 deletions pi_pin_manager/pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ def write(self, pin_number, value):
message = "Pin {0} not set as 'OUT' in '{1}'".format(pin_number, self.config_file)
raise PinConfigurationError(message)
self._gpio.output(pin_number, value)

def on(self, pin_number):
self.write(pin_number, 1)

def off(self, pin_number):
self.write(pin_number, 0)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='Pi-Pin-Manager',
version='0.0.6',
version='0.0.7',
author='Brian Hines',
author_email='[email protected]',
packages=['pi_pin_manager'],
Expand Down

0 comments on commit b5fcd0c

Please sign in to comment.