Mercurial > code > home > repos > light9
comparison light8/io.py @ 29:f595fdd4c548
minor cleanups, convert parallel port controller to a class
author | dmcc |
---|---|
date | Sun, 07 Jul 2002 10:41:06 +0000 |
parents | 7dbe8067acea |
children | 032b2b67bc10 |
comparison
equal
deleted
inserted
replaced
28:b0342f9ee328 | 29:f595fdd4c548 |
---|---|
1 | |
2 | |
3 from parport import * | 1 from parport import * |
4 | 2 |
5 DUMMY=1 | 3 class ParportDMX: |
6 | 4 def __init__(self, dummy=1, dimmers=68): |
7 def init(DUMMY_in): | 5 self.dummy = dummy |
8 global DUMMY | 6 if not dummy: |
9 if not DUMMY_in: | 7 getparport() |
10 | 8 def sendlevels(self, levels): |
11 getparport() | 9 if self.dummy: return |
12 DUMMY=0 | 10 levels = list(levels) + [0] |
13 | 11 # if levels[14] > 0: levels[14] = 100 # non-dim |
14 def sendlevels(levels): | 12 outstart() |
15 if DUMMY: return | 13 for p in range(1, dimmers + 2): |
16 levels = list(levels) + [0] | 14 outbyte(levels[p-1]*255 / 100) |
17 if levels[14] > 0: levels[14] = 100 | |
18 # print "levels", ' '.join(["%3.1f" % l for l in levels]) | |
19 outstart() | |
20 for p in range(1,70): | |
21 outbyte(levels[p-1]*255/100) |