Go Down

Topic: POV help please. (Read 460 times) previous topic - next topic

kculm

Hi All,

So I found a small POV project on http://www.instructables.com/id/3-Easy-ATTiny-Holiday-Gifts/ that consists of 5 LED's and a atTiny85.

I said to myself "Cool, I want to learn how to do this". Well I had all the parts and decided to build it.

I got it all put together and that's when I noticed the code was not for the Arduino.

Now I have look all over and have not found any example code that will work with my five LED POV.

If anyone has any sample code and would be so kind as to post it I would be very thankful.

And for the recorded, I am not trying to take the easy out. I plain on finding the information I need to learn how to write my own

Code. But it helps me to see what it looks like.

Thank you.



SouthernAtHeart

http://hlt.media.mit.edu/?p=1695

I'd suggest reading this article. And search for other tutorials regarding using the attiny chips with the Arduino. It's not so hard, really.

kculm


http://hlt.media.mit.edu/?p=1695

I'd suggest reading this article. And search for other tutorials regarding using the attiny chips with the Arduino. It's not so hard, really.


I can program the atTiny with the Arduino, I just don't have any POV sample code.

AWOL

Quote
I just don't have any POV sample code
There was code in the instructable article.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

lloyddean

#4
Jan 19, 2013, 10:45 pm Last Edit: Jan 20, 2013, 07:39 pm by lloyddean Reason: 1
Completely uncompiled or tested but something along the line of the following should do the trick -

Code: [Select]

#define ENTRIES(ARRAY)  (sizeof(ARRAY) / sizeof(ARRAY[0]))

const uint8_t   pinLED_1    = ??;   // replace ??? with pin num of LED1
const uint8_t   pinLED_2    = ??;   // replace ??? with pin num of LED2
const uint8_t   pinLED_3    = ??;   // replace ??? with pin num of LED3
const uint8_t   pinLED_4    = ??;   // replace ??? with pin num of LED4
const uint8_t   pinLED_5    = ??;   // replace ??? with pin num of LED5

const uint8_t   pinsLED[]   = { pinLED_1, pinLED_2, pinLED_3, pinLED_4, pinLED_6 };

struct pattern_delay_t
{
   uint8_t     _byte;
   uint8_t     _delay;
};

uint8_t message[] =
{
     { 0b00010001, 10 }
   , { 0b00010011, 10 }
   , { 0b00010101, 10 }
   , { 0b00011001, 10 }
   , { 0b00010001, 10 }
   , { 0b00000000, 10 }
   , { 0b00001110, 10 }
   , { 0b00010001, 30 }
   , { 0b00001110, 10 }
   , { 0b00000000, 10 }
   , { 0b00011111, 10 }
   , { 0b00010101, 10 }
   , { 0b00010001, 10 }
   , { 0b00000000, 10 }
   , { 0b00000000, 50 }
};

void loop()
{
   for ( int i = ENTRIES(message); i--; )
   {
       for ( int m = 0b00010000, n = 0; m; m >>= 1, n++ )
       {
           digitalWrite(pins[n], ((message[i]._byte & m) ? HIGH : LOW));
       }

       delay(digitalWrite(pinsLED[n]._delay);
   }
}

void setup()
{
   for ( int i = ENTRIES(pinsLED); i-- )
   {
       pinMode(pinsLED[i], OUTPUT);
   }
}


kculm


Quote
I just don't have any POV sample code
There was code in the instructable article.


I Could not get the Arduino to program on the AT.

Go Up