I have a LED strip that I want to control with my Raspberry PI. I have connected it to the GPIO10 (MOSI) and GPIO11 (CLK). The SPI module is loaded in Raspbian.
I have created a file that I send to /dev/spidev-0.0, when i do that i can control the LEDs.
If i send a file that looks like the one below i turn the LED off.
00000000 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000010 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000020 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000030 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000040 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000050 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
00000060 80 00 80 00 80 00 80 00 80 00 ..........
If i send a file that looks like the one below i turn the LED on.
00000000 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF ................
00000010 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000020 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000030 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000040 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000050 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000060 FF FF FF FF FF FF FF FF FF FF ..........
My problem is how do i do this in Python? I want to create this strings on the fly and send them to the SPI interface.