Mercurial > templog
annotate py/gpio_rpi.py @ 533:815f811f6a65
Fixed some warnings
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 28 Apr 2015 22:44:10 +0800 |
parents | dd8895652485 |
children | d9b819dcac53 |
rev | line source |
---|---|
527 | 1 import os |
2 | |
3 import RPi.GPIO as GPIO | |
4 | |
5 from utils import L,D,EX,W | |
6 | |
7 __all__ = ["Gpio"] | |
8 | |
9 class Gpio(object): | |
10 def __init__(self, pin, name): | |
11 self.pin = pin | |
12 self.name = name | |
13 GPIO.setmode(GPIO.BOARD) | |
14 GPIO.setup(self.pin, GPIO.OUT) | |
15 | |
16 def turn(self, value): | |
17 self.state = bool(value) | |
18 GPIO.output(self.pin, self.state) | |
19 | |
20 def get_state(self): | |
21 return GPIO.input(self.pin) |