I am trying to control a strip of lights that I have using a UCS1903.
I am not understanding things correctly. I understand that a square wave can be used to indicate a 1 or a 0 and that pauses in sending a signal can indicate other functions.
How does this translate to sending infomation over spi.
Im not sure. If I could watch was is happening on the MOSI as it is attached to the flash storage...if I connect the DIN of my light strip to MOSI and install software or boot up the machine, the lights start going about changing colours and lighting up...
But plugged into CS1 and trying to send data..
The lights take a 24bit piece of data r(8bits) g(8bits) and b(8bits)
Here is code showing how my brain is comprehending this.
import onionSpi
import time
busnum = 1
deviceid = 32766
spi = onionSpi.OnionSpi(busnum, deviceid)
spi.speed = 400000
spi.delay = 1
spi.mosi = 18
spi.mode = 0
#spi.bitsPerWord = 1000
# spi.bitsPerWord = 24
# spi.modeBits = ['lsbfirst']
spi.modeBits = 0x8
spi.setupDevice()
spi.registerDevice()
#spi.bitsPerWord = 3
device_check = spi.checkDevice()
print device_check
print 'SPI MOSI GPIO: %d'%(spi.mosi)
print 'SPI Speed: %d Hz (%d kHz)'%(spi.speed, spi.speed/1000)
print 'Mode Bits: 0x%x'%(spi.modeBits)
# R7 R6 R5 R4 R3 R2 R1 R0 G7 G6 G5 G4 G3 G2 G1 G0 B7 B6 B5 B4 B3 B2 B1 B0
led_rgb = []
led_full = [ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]
led_red = [ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]
led_green = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
led_blue = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
# ret1 = spi.writeBytes(0x00, led_red)
# ret2 = spi.writeBytes(0x00, led_green)
# ret3 = spi.writeBytes(0x00, led_blue)
# print ret1
# print ret2
# print ret3
vals = [0x00, 0x1C, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2D]
ret = spi.write(vals)
# spi.write(led_red)
# time.sleep(1)
# spi.write(led_green)
# time.sleep(1)
# spi.write(led_blue)
# time.sleep(1)