#!/usr/bin/python from MCP23S17 import * from thread import * from random import randint class lightChip(MCP23S17): def __init__(self, addr,cable_select,clock,miso,mosi): MCP23S17.__init__(self,addr, cable_select, clock, miso, mosi, False) self.setDirection(0xff,0x00) # configure a as input, b as outputs self.sendSPI(0x0C, 0xFF) # pullups aktivieren self.sendSPI(0x02, 0xFF) # logik invertieren self.state=[0,0,0,0,0,0,0,0] start_new_thread(self.shine,()) def shine(self): self.shining=True lastval = 0 selected = 0 while self.shining: d=0 for t in range(10,0,-1): for chnl in range(0,8): if self.state[chnl]>=t: d|=1<