xtmas_neopixel icon indicating copy to clipboard operation
xtmas_neopixel copied to clipboard

don't Want Random Effects

Open LedArts opened this issue 8 years ago • 6 comments

hello sir, i try this program but i don't want to run random effects every time. i want to serial wise effects as i write in program. Can u please stop the shuffle or random function. n give me serial wise code.

thank you

LedArts avatar Feb 17 '17 15:02 LedArts

You can just rewrite the shuffle function, just fill-up the array with your favorite sequence in any order.

17 Фев 2017 г. 18:21 пользователь "LedArts" [email protected] написал:

hello sir, i try this program but i don't want to run random effects every time. i want to serial wise effects as i write in program. Can u please stop the shuffle or random function. n give me serial wise code.

thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sfrwmaker/xtmas_neopixel/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ASVrH0eTp7TsqDDMYVVMUQoahot7IYBxks5rdbsSgaJpZM4MEY-X .

sfrwmaker avatar Feb 17 '17 15:02 sfrwmaker

sir can u give me any example how to write it....

LedArts avatar Feb 17 '17 16:02 LedArts

Hello!

byte shuffle::next(void) { if (curr >= num_anim) curr = 0; return index[curr++]; }

sir can u give me any example how to write it....

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sfrwmaker/xtmas_neopixel/issues/1#issuecomment-280700588, or mute the thread https://github.com/notifications/unsubscribe-auth/ASVrH7ff1oDUye-QrO4R0cc0RWJoMa7Wks5rdc1hgaJpZM4MEY-X.

sfrwmaker avatar Feb 17 '17 17:02 sfrwmaker

thank you so much sir i try it and no error occur. but i have one more question in "void shuffle::randomize(void)" there is any change in this function or it will be as it is.

byte shuffle::next(void) { if (curr >= num_anim) curr = 0; return index[curr++]; } void shuffle::randomize(void) { for (byte i = 0; i < num_anim*2; ++i) { byte p1 = random(num_anim); byte p2 = random(num_anim); if (p1 != p2) { byte t = index[p2]; index[p2] = index[p1]; index[p1] = t; } } curr = 0; }

LedArts avatar Feb 17 '17 17:02 LedArts

This function is no longer used in this case. You can delete it completely if you wish. If it is not obvious, i can explain how it works. To ensure that all the sequences are run in a turn, i swap two sequences in the array in the randomize function.

thank you so much sir i try it and no error occur. but i have one more question in "void shuffle::randomize(void)" there is any change in this function or it will be as it is.

byte shuffle::next(void) { if (curr >= num_anim) curr = 0; return index[curr++]; } void shuffle::randomize(void) { for (byte i = 0; i < num_anim*2; ++i) { byte p1 = random(num_anim); byte p2 = random(num_anim); if (p1 != p2) { byte t = index[p2]; index[p2] = index[p1]; index[p1] = t; } } curr = 0; }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sfrwmaker/xtmas_neopixel/issues/1#issuecomment-280713689, or mute the thread https://github.com/notifications/unsubscribe-auth/ASVrH9jRlumT6hiqABN8ZW0QFVdAXyziks5rddisgaJpZM4MEY-X.

sfrwmaker avatar Feb 17 '17 17:02 sfrwmaker

thanxxxxxxxxxxxxxxxxxxxxxx lot sir....... it works....... i am working on this code from last 7 days i hve one more issue which i am posting in next issue

LedArts avatar Feb 17 '17 18:02 LedArts