So I am creating a photobooth in python. I've sourced a couple of different python photobooths that I've found to combine all of the features I want. Now I've finally received the 8x8 LED matrix I ordered from China (http://wiki.52pi.com/index.php/RPI-RGB- ... KU:EP-0075). Not having done a whole bunch of research before I ordered it, I've found that it's based on a 74HC595 chip. I realize that I can make it behave how I want if I were to write the code in C (part of which is shown below). But I'm really looking for some advice on how I can make this matrix work with my python app. The matrix is only serving as a 3 second countdown (3 static numbers), but I just haven't found a reliable way to achieve the multiplexing in python. (From what I can tell, a MAX7219 matrix would have been much easier, but I'm trying to work with what I have now)
Code: Select all
#include <stdio.h>
#include <wiringPi.h>
#include <wiringPiSPI.h>
#include <stdint.h>
#define RED_DATA 0
#define BLUE_DATA 1
#define GREEN_DATA 2
int main(void)
{
static uint8_t data[4] = {0x0,0x0,0x0,0x0};
wiringPiSetup();
wiringPiSPISetup(0,500000);
while(1)
{
static uint8_t three[8] = {0x00,0x3c,0x66,0x60,0x38,0x60,0x66,0x3c};
int j;
int x=2;
for ( j=0;j<8;j++)
{
data[0] = 0xFF;
data[2] = ~three[j];
data[1] = 0xFF;
data[3] = 0x01 << j ;
wiringPiSPIDataRW(0,data,sizeof(data));
delay(x);
};
};
}