diff --git a/CHANGES.txt b/CHANGES.txt index d4da7fc..a0c1d44 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/README.md b/README.md index 42cd332..4680be5 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/pi_pin_manager/pins.py b/pi_pin_manager/pins.py index a3911ef..f63f7c0 100644 --- a/pi_pin_manager/pins.py +++ b/pi_pin_manager/pins.py @@ -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) diff --git a/setup.py b/setup.py index 9ded5c8..583d96f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='Pi-Pin-Manager', - version='0.0.6', + version='0.0.7', author='Brian Hines', author_email='brian@projectweekend.net', packages=['pi_pin_manager'],