Pages: 1 [2]   Go Down
Author Topic: :) my first not-so-good persistence of vision  (Read 6565 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley-grin sure. i didn't realize people would like the codes so much; lol, i didn't think anything of it.

let me post some comment on the codes, hopefully it will be helpful to whoever want to try something similar  smiley


Quote
// 7 LED POV

// letter width. since i have 7 LED, then each letter would look like a 7 x 5 matrix
#define WIDTH 5

//library, each letter stored in hex number instead of bit, five hex numbers make a letter; hence each hex number represent a column of a letter.

const byte font [][WIDTH] =
{
 {0x7e, 0x09, 0x09, 0x09, 0x7e}, //A
 {0x7f, 0x49, 0x49, 0x49, 0x36}, //B
 {0x3e, 0x41, 0x41, 0x41, 0x22}, //C
 {0x7f, 0x41, 0x41, 0x22, 0x1c}, //D
 {0x7f, 0x49, 0x49, 0x49, 0x49}, //E
 {0x7f, 0x09, 0x09, 0x09, 0x09}, //F
 {0x7e, 0x41, 0x49, 0x49, 0x38}, //G
 {0x7f, 0x08, 0x08, 0x08, 0x7f}, //H
 {0x00, 0x41, 0x7f, 0x41, 0x00}, //I
 {0x30, 0x40, 0x41, 0x7f, 0x01}, //J
 {0x7f, 0x08, 0x14, 0x22, 0x41}, //K
 {0x7f, 0x40, 0x40, 0x40, 0x40}, //L
 {0x7f, 0x02, 0x04, 0x02, 0x7f}, //M
 {0x7f, 0x02, 0x0c, 0x10, 0x7f}, //N
 {0x3e, 0x41, 0x41, 0x41, 0x3e}, //O
 {0x1e, 0x21, 0x21, 0x21, 0x5e}, //Q
 {0x7f, 0x09, 0x19, 0x29, 0x46}, //R
 {0x26, 0x49, 0x49, 0x49, 0x32}, //S
 {0x01, 0x01, 0x7f, 0x01, 0x01}, //T
 {0x3f, 0x40, 0x40, 0x40, 0x3f}, //U
 {0x07, 0x38, 0x40, 0x38, 0x07}, //V
 {0x3f, 0x40, 0x3f, 0x40, 0x3f}, //W
 {0x63, 0x14, 0x08, 0x14, 0x63}, //X
 {0x07, 0x08, 0x70, 0x08, 0x07}, //Y
 {0x61, 0x51, 0x49, 0x45, 0x43} //Z  
};


//set up pin 0 - 7 as OUTPUT
void setup()
{  
 for (int k=0;k<=7;k++)
    pinMode(k,OUTPUT);
}

//method of displaying the letters. displaying each column (one hex number) of the letter one by one through PORTD. then after a letter, it puts a space in between and move onto the next letter. until however long of the String you wish to display.
//each letter is first turned into ASCII integer, then minus 65. It would then be the row of the letter from the library above. (ex. A is 65 in ASCII, but row 0 in my library)
// furthermore, because of the way i made the hardware, it displays each letter starting from the back of the sentence, and each letter from the right most column.

void display (char POVstring[])
{
 for (int i=(strlen(POVstring)-1); i>=0; i--)
   {  for (int j=(WIDTH-1); j>=0; j--)
       { PORTD = font[(int)POVstring-65][j]; delay(1); }
       PORTD = B00000000; delay(1);
   }
}

// you simply feed a string to display it. this code only allows capital letters. however, if you add characters or lowercases in the library above, it would also be able to display it. (but then it would minus a different number instead of 65 above)

void loop()
{
if ( analogRead(5)==0 )
 { display("HELLO"); }
}
« Last Edit: June 29, 2010, 07:36:49 am by alansmk » Logged

Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

impressive first project! well its not not-so-good. Its kick ass man! cheerup! love what you do(did) and do what you love!
Logged

Be The Change...

Atlanta
Offline Offline
Sr. Member
****
Karma: 0
Posts: 254
Arduino still rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Congrats Alan on your POV display, very nice indeed!

I am a newcomer to Arduino, a longtime occasional developer, and just now discovered your post.  Arduino and open source has got me dizzy with excitement and ideas, but I also carry a bit of guilt that I bought my first Arduino for a work-related project that cannot be openly shared.  

Your Arduino code for POV is so compact and wonderfully clean, with your permission I'd like to use your sketch to begin my next project for a color POV, not job related, and release the result as open source.  Is this ok with you?

Also did you ever try delayMicroseconds() and a faster motor speed?  Hope your excellent POV Display has brought you more feeling of satisfaction and accomplishment bkoz you sure do deserve it.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks! glad people are still coming across this.
you are welcome to use it anyway you like.

smiley i made this first project long time ago, learned a lot more since then.

I can probably make this better if i ever re-do a simliar POV.
delayMicroseconds() is definitely needed, hm.
i also tried using TimerOne library and interrupts to keep counts in another POV. that worked out okay too.

and i also tried using just time counting using the example Blink Without Delay() and i personally don't like that too much.

have fun with arduino!
Logged

Netherlands
Offline Offline
God Member
*****
Karma: 5
Posts: 615
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, let me be the first to say it looks horrible  !
(ofcourse I'm lying, I just hate to have the same opinion as everyone else  smiley-wink )

I've been thinking of making one too, maybe still will do one day.

« Last Edit: December 28, 2010, 03:38:41 pm by Simpson_Jr » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Very nice.

By using PORTD commands associated with pins 0-6, you are limiting the sketch to 168/328 processors only as the 1280/2560 processors map different pins to different port letters. A simple comment at the top of the sketch will remind you (and other users) that they will have to change the wiring if used on  mega boards.

Lefty
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6944
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been having this question since I saw this post a while ago. How was power fed to the arduino and LEDs?
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have been having this question since I saw this post a while ago. How was power fed to the arduino and LEDs?

What, you don't believe in spinning batteries?  ;D
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what a nice project. can you give a the schematic of this project?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does this project have a sensors?
Logged

Pages: 1 [2]   Go Up
Jump to: