Month: July 2010

More POV

Got some POV code working….

Problem is sync – not synched at all, so you can see what it says but it has no idea when to start the sequence relative to the user waving it about.

We’ll investigate a switch with a weight on as a synch pulse soon.

Here’s some pictures of the board so far. The LEDs are mounted on some strip board and a length of old CAT5 connects it to a small shield board which plugs into the Arduino. The CAT5 supplies power and the three control lines for the shift reg.

A photo of LED wavy end bit and another of the whole lot

The bit you wave about
Both ends of the cable...

How the code works…

Its really simple… I wrote a C++ application to generate the alphabet. I’ll post that for download.

Then a message is simply an array containing a list of pointers to smaller letter arrays. Each letter array holds a length byte followed by the binary for the letters. Binary is nice because you can tell by looking whether its right.

So the code that really matters is:

int* iMsg[] = {H,E,L,L,O};
int iMsgLen = 5;

void loop()
{
  // send the next column for the current character
  sendByteOut(iMsg[iMsgIndex][iCharIndex]);

  // wait a moment
  delay(1);

  // move to the next column
  iCharIndex++;

  // have we run out of columns for this letter?
  if (iCharIndex == iCharLen)
  {
     // start at first column - 1 because 0 is length byte
     iCharIndex = 1;
     // and move to the next letter
     iMsgIndex++;
  }

  // now see if we have got to the end of the message
  if (iMsgIndex == iMsgLen)
  {
     // start at first letter again
     iMsgIndex = 0;
  }

  // set the length  - this could be in an if statement - but it really doesn't make much difference
  iCharLen = iMsg[iMsgIndex][0];

}

All the code is in the download area.

Doing the synch things seems like it will be fiddly. Might come back to that after a play with TV output.

Win32 .net application to generate Arduino font source code is her :  Adruino 8 bit font creator for POV