My first Arduino project: a classic persistence of vision display.
Definitely disappointed; it seems a lot worse than other ones i have seen people make.
but i think i will try again with another design. a clock perhaps.
any comment on my code? Is there another way to code POV?
it seems so.. laggy?
i read something about using interrupt, but i didn't exactly know how that works. I only have very basic C++/ arduino programming experience.
any advice would be appreciated!
// 7 LED POV
// letter width
#define WIDTH 5//library
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
};void setup()
{
for (int k=0;k<=7;k++)
pinMode(k,OUTPUT);
}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);*
- }*
}
void loop()
{
if ( analogRead(5)==0 )- { display("HELLO"); }*
}[/quote]