DM13A 16-bit Constant Current LED Driver, Raspberry Pi

DM13A 16-bit Constant Current LED Driver, Raspberry Pi
#!/usr/bin/env python import RPi.GPIO as GPIO import time latchPin = 6 clockPin = 19 dataPin = 13 def setup(): GPIO.setmode(GPIO.BCM) GPIO.setup(latchPin, GPIO.OUT) GPIO.setup(clockPin, GPIO.OUT) GPIO.setup(dataPin, GPIO.OUT) GPIO.output(latchPin, GPIO.LOW) GPIO.output(clockPin, GPIO.LOW) GPIO.output(dataPin, GPIO.LOW) def doLatch(): GPIO.output(latchPin, GPIO.HIGH) GPIO.output(latchPin, GPIO.LOW) def doClock(): GPIO.output(clockPin, GPIO.HIGH) GPIO.output(clockPin, GPIO.LOW) def doHigh(): GPIO.output(dataPin, GPIO.HIGH) doClock() def doLow(): GPIO.output(dataPin, GPIO.LOW) doClock() def loop(): while True: for i in range(0,8): doHigh() doLatch() time.sleep(0.1) doLow() doLatch() time.sleep(0.1) for i in range(0,16): doHigh() doLatch() time.sleep(0.1) for i in range(0,16): doLow() doLatch() time.sleep(0.1) def destroy(): GPIO.cleanup() if __name__ == '__main__': setup() try: loop() except KeyboardInterrupt: destroy()