Created
July 31, 2013 19:15
-
-
Save OrangeTux/6125201 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" adapters.py """ | |
class PinAdapter: | |
def __init__(self, *args): | |
if(os.uname()[4][:3] != 'arm'): | |
return MockPin(*args) | |
else: | |
from ablib import Pin | |
return Pin(*args) | |
class MockPin: | |
def __init__(self, *args): | |
# some fake init | |
pass | |
def on(self): | |
pass | |
def off(self): | |
pass | |
""" scanner.py """ | |
from adapters import PinAdapter | |
pin = PinAdapter('W', '14', 'hight') | |
pin.on() | |
pin.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment