Mercurial > templog
comparison py/fridge.py @ 148:b32e5a11a4cb
few updates, seems to run
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 15 Dec 2012 23:49:08 +0800 |
parents | 6517ddee3187 |
children | d686b111dab4 |
comparison
equal
deleted
inserted
replaced
147:ab1e7bf77d69 | 148:b32e5a11a4cb |
---|---|
20 def setup_gpio(self): | 20 def setup_gpio(self): |
21 dir_fn = '%s/direction' % config.FRIDGE_GPIO | 21 dir_fn = '%s/direction' % config.FRIDGE_GPIO |
22 with open(dir_fn, 'w') as f: | 22 with open(dir_fn, 'w') as f: |
23 f.write('low') | 23 f.write('low') |
24 val_fn = '%s/value' % config.FRIDGE_GPIO | 24 val_fn = '%s/value' % config.FRIDGE_GPIO |
25 self.value_file = f.open(val_fn, 'r+') | 25 self.value_file = open(val_fn, 'r+') |
26 | 26 |
27 def turn(self, value): | 27 def turn(self, value): |
28 self.value_file.seek(0) | 28 self.value_file.seek(0) |
29 if value: | 29 if value: |
30 self.value_file.write('1') | 30 self.value_file.write('1') |