Mercurial > templog
annotate py/gpio_test.py @ 581:b4d6f1ae0b9e
make overshoot_factor floating point
add a proper error message for noparamsyet
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 29 Nov 2015 09:30:36 +0800 |
parents | 73257bae83ea |
children |
rev | line source |
---|---|
527 | 1 import os |
2 | |
3 from utils import L,D,EX,W | |
4 | |
5 __all__ = ["Gpio"] | |
6 | |
7 class Gpio(object): | |
8 def __init__(self, pin, name): | |
9 self.name = name | |
10 self.pin = name | |
11 self.state = False | |
12 L("Test GPIO %s pin %d started, set off." % (name, pin)) | |
13 | |
14 def turn(self, value): | |
15 self.state = bool(value) | |
16 onoff = ("off", "on")[int(self.state)] | |
530 | 17 L("Test GPIO %s pin %s turned %s" % (self.name, self.pin, onoff)) |
527 | 18 |
19 def get_state(self): | |
20 return self.state | |
21 | |
22 | |
23 |