Go Down

Topic: Stuck... any sugesstions? (Read 368 times) previous topic - next topic


Ok so I've been able to draw a predefined sprite on an LED matrix with 2 595s, but I seem to be stuck as how to update the display dynamically. Any ideas on how to update the display via serial?

Code: [Select]

byte dataPin = 0; // 74HC595 pin 14
byte latchPin = 1; // 74HC595 pin 12
byte clockPin = 2; // 74HC595 pin 11

byte data; // storage for the current data byte
byte dataArray[8]; // define the data array

byte row; // storrage for the current row byte
byte rowArray[8]; // define the row array

void setup()
 pinMode(dataPin, OUTPUT); //pinmode setup
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);

// column registers for image data.
 dataArray[0] = B00011000;
 dataArray[1] = B00111100;
 dataArray[2] = B01111110;
 dataArray[3] = B11011011;
 dataArray[4] = B11111111;
 dataArray[5] = B01011010;
 dataArray[6] = B10000001;
 dataArray[7] = B01000010;

// row registers... DO NOT CHANGE THESE!
 rowArray[0] = B01111111;
 rowArray[1] = B10111111;
 rowArray[2] = B11011111;
 rowArray[3] = B11101111;
 rowArray[4] = B11110111;
 rowArray[5] = B11111011;
 rowArray[6] = B11111101;
 rowArray[7] = B11111110;

void loop()

void drawSprite()
 for(int j = 0; j < 8; j++){ // load the byte...
   data = dataArray[j]; // from the data array...
   row = rowArray[j]; // and the row array
   digitalWrite(latchPin, LOW); // ground the latch pin
   shiftOut(dataPin, clockPin, MSBFIRST, data); // shift out the data
   shiftOut(dataPin, clockPin, MSBFIRST, row); // shift out the row byte
   digitalWrite(latchPin, HIGH); // it's finished so bring the latch pin high
   //delay(50); // left in to display the plex at low speed    
there are 10 types of people in this world, those who can read binary and those who can't.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131