class Controller(object): def __init__(self, port, baud): self._serial = SerialConnection() self._serial.connect(port,baud) self._pins = {} def changePin(self,pin, value): if pin in self._pins: p = self._pins[pin] p._value = value self._serial.write_packet(p.toPacket()) def addPins(self,pins): for pin in pins: self._pins[pin._pin] = pin def addPin(self,pin): self._pins[pin._pin] = pin
def __init__(self, port, baud): self._serial = SerialConnection() self._serial.connect(port,baud) self._pins = {}