Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- from time import sleep
- class Gpio:
- def __init__( self, name ):
- self.name = name
- self._value_path = Path( '/dev/gpio', name, 'value' )
- def get( self ):
- return int( self._value_path.read_text() )
- def set( self, value ):
- self._value_path.write_text( str( value ) )
- relay1 = Gpio( 'relay-jp1' )
- relay1.set( 1 )
- sleep( 1 )
- relay1.set( 0 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement