Pages: [1]   Go Down
Author Topic: Persistence Of Vision  (POV) software  (Read 917 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This looks really interesting.  Can anyone get this to work?  It doesn't seem to work for me.  There is no activity on pins 2.3.4.5.6 when checked with an oscilloscope.  How does one troubleshoot the code?  I am new at coding and just learning. I particularly don't understand the line:  void printLetter(int letter[])

Does anyone have any other Arduino POV projects?

/*
[ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533]
persistence of vision typography with arduino
michael zoellner - march 2006
http://i.document.m05.de

connect anodes (+) of 5 leds to digital ports of the arduino board
and put 20-50 ohm resistors from the cathode (-) to ground.

the letters are lookup tables consisting arrays width the dot status in y rows.
[ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533][ch65533]
*/


// defining the alphabet
int _[] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0};
int A[] = {0,1,1,1,1, 1,0,1,0,0, 0,1,1,1,1};
int B[] = {1,1,1,1,1, 1,0,1,0,1, 0,1,0,1,0};
int C[] = {0,1,1,1,0, 1,0,0,0,1, 1,0,0,0,1};
int D[] = {1,1,1,1,1, 1,0,0,0,1, 0,1,1,1,0};
int E[] = {1,1,1,1,1, 1,0,1,0,1, 1,0,1,0,1};
int F[] = {1,1,1,1,1, 1,0,1,0,0, 1,0,1,0,0};
int G[] = {0,1,1,1,0, 1,0,1,0,1, 0,0,1,1,0};
int H[] = {1,1,1,1,1, 0,0,1,0,0, 1,1,1,1,1};
int I[] = {0,0,0,0,1, 1,0,1,1,1, 0,0,0,0,1};
int J[] = {1,0,0,0,0, 1,0,0,0,1, 1,1,1,1,1};
int K[] = {1,1,1,1,1, 0,0,1,0,0, 0,1,0,1,1};
int L[] = {1,1,1,1,1, 0,0,0,0,1, 0,0,0,0,1};
int M[] = {1,1,1,1,1, 0,1,1,0,0, 0,1,1,1,1};
int N[] = {1,1,1,1,1, 1,0,0,0,0, 0,1,1,1,1};
int O[] = {0,1,1,1,0, 1,0,0,0,1, 0,1,1,1,0};
int P[] = {1,1,1,1,1, 1,0,1,0,0, 0,1,0,0,0};
int Q[] = {0,1,1,1,1, 1,0,0,1,1, 0,1,1,1,1};
int R[] = {1,1,1,1,1, 1,0,1,0,0, 0,1,0,1,1};
int S[] = {0,1,0,0,1, 1,0,1,0,1, 1,0,0,1,0};
int T[] = {1,0,0,0,0, 1,1,1,1,1, 1,0,0,0,0};
int U[] = {1,1,1,1,1, 0,0,0,0,1, 1,1,1,1,1};
int V[] = {1,1,1,1,0, 0,0,0,0,1, 1,1,1,1,0};
int W[] = {1,1,1,1,0, 0,0,1,1,0, 1,1,1,1,0};
int X[] = {1,1,0,1,1, 0,0,1,0,0, 1,1,0,1,1};
int Y[] = {1,1,0,0,0, 0,0,1,0,0, 1,1,1,1,1};
int Z[] = {1,0,0,1,1, 1,0,1,0,1, 1,1,0,0,1};

int letterSpace;
int dotTime;

void setup()
{
  // setting the ports of the leds to OUTPUT
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  
  // defining the space between the letters (ms)
  letterSpace = 6;
  // defining the time dots appear (ms)
  dotTime = 3;
  
}

void printLetter(int letter[])
{
  int y;
  
  // printing the first y row of the letter
  for (y=0; y<5; y++)
  {
    digitalWrite(y+2, letter[y]);
  }
  delay(dotTime);
  
  // printing the second y row of the letter
  for (y=0; y<5; y++)
  {
    digitalWrite(y+2, letter[y+5]);
  }
  delay(dotTime);
  
  // printing the third y row of the letter
  for (y=0; y<5; y++)
  {
    digitalWrite(y+2, letter[y+10]);
  }
  delay(dotTime);
  
  // printing the sspace between the letters
  for (y=0; y<5; y++)
  {
    digitalWrite(y+2, 0);
  }
  delay(letterSpace);
}

void loop()
{
  // printing some letters
  printLetter(N);
  printLetter(E);
  printLetter(R);
  printLetter(D);
  printLetter(S);
  printLetter(_);
}
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

It works for me. I used a 220 ohm resistor on -each- LED. I can't say I can see the word it's supposed to display yet, but there's definitely something in there...I think it just needs to have the timing values adjusted.

Scratch that-- I can see the word pretty well now. You just have to wave it in front of your face like a raving lunatic, and then you'll see it. It will make a good tutorial for my prototyping classes...

PS:
void printLetter() is a user function that spits out the proper LED values,  
and
int letter[] is an array variable.
« Last Edit: November 21, 2006, 12:18:18 am by Daniel » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, Daniel, I will set it up again.  I must have a mistake somewhere.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not getting it working either.

I've actually noticed that with one of my programs, when I have a large amount of data, it doesn't run on my arduino.  i drop the sizes down, and it works.

In fact, I have a very simple setup() and loop() which run fine on their own, but once i add all of the data structures, it fails...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AHA!

if you change all of the "int L[] = { ... }" to be "static int ... " it works.  ie:


  static int _[] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0};
  static int A[] = {0,1,1,1,1, 1,0,1,0,0, 0,1,1,1,1};
  static int B[] = {1,1,1,1,1, 1,0,1,0,1, 0,1,0,1,0};
  static int C[] = {0,1,1,1,0, 1,0,0,0,1, 1,0,0,0,1};


I just figure this out with one of my sketches
(http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1165169485)

Happy coding, everyone! smiley-grin
Logged

Florida, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 146
meow!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could save a lot of space by changing the arrays from "int" (2 bytes) to "char" (1 byte):

static char _[] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0};
// ... etc ...

You would not have to modify any of the rest of the code.

If you are more ambitious, you could replace each array with a single "int", because each value in the array is just a bit (either 0 or 1).  For example:

#define LETTER(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)  \
    ((a)<<14|(b)<<13|(c)<<12|(d)<<11|(e)<<10|    \
    ((f)<<9|(g)<<8|(h)<<7|(i)<<6|(j)<<5|     \
    ((k)<<4|(l)<<3|(m)<<2|(n)<<1|(o))

Note the backslashes at the end of the first 3 lines, which allow the macro definition to span lines.

static int _ = LETTER(0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0);
static int A = LETTER(0,1,1,1,1, 1,0,1,0,0, 0,1,1,1,1);
// ... etc ...

Then, to access a particular bit within a letter, instead of accessing array
  • , you would retrieve a bit using the following macro:

#define GETBIT(variable,position)   (((variable) >> (15-position)) & 1)

For example, GETBIT(A,0) would access the leftmost bit in the variable A.

While this is a bit of work, it would shrink your data size by a factor of 16.  But of course this matters only if you intend to make the rest of the code more complex.
Logged

Austin, TX
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Shh! I am hunting wabbit. Killlll the wabbit!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was having trouble getting it to work as well.  I checked the signals with the an oscilliscope and nothing.

After scratching my head I finally figured out that the problem (for me) was that the IDE chose the wrong chip ATmega8 versus ATmega168
Logged

Pages: [1]   Go Up
Jump to: