Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //populate a separate array for 'hue mask'
- void hue_array(){
- for(byte i = 0; i < ((NUM_LEDS/2)+ 1); i++){
- static byte x = 0;
- if(x++ == 5){
- hue += 20;
- x = 0;
- }
- temp[i] = hue;
- }
- }
- //
- void wave_fx(){
- static byte middle = NUM_LEDS/2;
- currentMillis = millis();
- if(currentMillis - previousMillis >= 10) {
- count++;
- if (count == 255) {
- count = 0;
- }
- for (byte i = 0; i <= middle; i++){
- wave = sin8((millis() / wave_scale) * i);
- hue = temp[i]; //populate hue before calling CHSV, otherwise it is destructive to leds[]
- leds[i] = CHSV(hue, 255, wave);
- }
- for(byte i = middle; i <= NUM_LEDS; i++){
- leds[i] = leds[NUM_LEDS - i];
- }
- previousMillis = currentMillis;
- LEDS.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement