??? how to LOOP the 3x3x3 animation ???

MiniPOV4 and previous versions

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
megasound
 
Posts: 4
Joined: Sun Jan 24, 2010 7:55 am

??? how to LOOP the 3x3x3 animation ???

Post by megasound »

Hi,
last week i bought a minipov3 board...thats working great
then i follwed your GREAT toturial making a 3x3x3 led cube. :D
IT WORKING GREAT, THANKS for that !!!! :D

i only have one small question
i downloaded your test software : http://cachefly.oreilly.com/make/LEDcube.zip thats working OK

but now i want to LOOP the "led animation" .
finally i want to make a "sleeping" light for my daugther and thats why it has to LOOP.
the current test file doesn't loop :?

can someone please give me the code , or explanation HOW TO loop the animation i created ?

many many thanks in advance
MEnno
Attachments
ledcubetest.c
this code DOESN'T loop
(9.15 KiB) Downloaded 379 times

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: ??? how to LOOP the 3x3x3 animation ???

Post by adafruit »

hi we didnt write the 3x3x3 cube code...so unfortunately we dont know what to suggest :? can you contact the author of that code?

charliex
 
Posts: 179
Joined: Sat Nov 28, 2009 5:54 pm

Re: ??? how to LOOP the 3x3x3 animation ???

Post by charliex »

if you're looking for it to run the internal loop forever then its probably something like :-

Code: Select all

for(;;) {
  // loop through entire Image Table of Image Elements
  //   each Image Element consists of a 3 planes of 3x3 LED (each LED on or off) data and a Duration
  int j;
  j = 0;
  do {
    displayImage(j);
    j++;
  } while (pgm_read_byte(&imageTab[j].imageDuration) != 0);  // 0 signifies end of table
}
caveat, i don't have, or have ever seen a minipov

megasound
 
Posts: 4
Joined: Sun Jan 24, 2010 7:55 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by megasound »

thanks

but can you put that in the ledcubetest.c and make 1 new .c file of it ?
sorry but i do not understand were to put this line of code...

thanks in advance
m

charliex
 
Posts: 179
Joined: Sat Nov 28, 2009 5:54 pm

Re: ??? how to LOOP the 3x3x3 animation ???

Post by charliex »

try this.
Attachments
ledcubetest.c
wrapped with infinite for
(9.18 KiB) Downloaded 392 times

megasound
 
Posts: 4
Joined: Sun Jan 24, 2010 7:55 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by megasound »

MANY THNKS MAN!
i will give it a try....

m

megasound
 
Posts: 4
Joined: Sun Jan 24, 2010 7:55 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by megasound »

THANKX man
its working GREAT

thankx for aal the support !!!
m

charliex
 
Posts: 179
Joined: Sat Nov 28, 2009 5:54 pm

Re: ??? how to LOOP the 3x3x3 animation ???

Post by charliex »

anytime, all i did was basically add an infinite loop around the bit that did all the work,the for(;;) , and make sure the index was set back to zero.

stevenl1
 
Posts: 19
Joined: Tue Jun 08, 2010 10:54 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by stevenl1 »

I was curious and glanced at this because I am looking into the led cube stuff.

I looked at the original code and if you deleted that last sequence for the leds the origional loop would go forever, and if you wanted it to stop again you just include that line.

For those who care, I suggest trying with the following line deleted for it to loop, hopefully messing with less code this way.

Code: Select all

{ 0b000, 0b000, 0b000, 0b000, 0b000, 0b000, 0b000, 0b000, 0b000,     0 },  // this is a dummy element for end of table (duration=0)

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by mtbf0 »

stevenl1 wrote: I looked at the original code and if you deleted that last sequence for the leds the origional loop would go forever, and if you wanted it to stop again you just include that line.
i think that if you delete the 0 duration line in the animation, the code will just start interpretting itself as an animation sequence and run until it happens to a chunk of itself with duration 0.

maybe.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: ??? how to LOOP the 3x3x3 animation ???

Post by mtbf0 »

mtbf0 wrote:maybe.
ok. looked at the code and now i'm pretty sure.

when the code finishes interpreting itself as image data it will probably find some zeroed out code space and stop there.

Locked
Please be positive and constructive with your questions and comments.

Return to “MiniPOV”