Created
November 22, 2020 13:44
-
-
Save Nekodigi/493be99b4ae815aaa04d26931a896caf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_NeoPixel.h> | |
#define PIN 2 | |
#define NUMPIXELS 300 | |
#define DELAY 10 | |
int frameCount = 0; | |
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
void setup() { | |
pixels.begin(); | |
} | |
void loop() { | |
pixels.clear(); | |
for(int i=0; i<NUMPIXELS/2; i++){ | |
if(0 < (i+frameCount)/4. && (i+frameCount)/4. < PI){ | |
pixels.setPixelColor(i, pixels.ColorHSV(((i+frameCount)*500), 255, sin((i+frameCount)/4.)*5));//~65536?, ~256, ~256 | |
pixels.setPixelColor(NUMPIXELS-i, pixels.ColorHSV(((i+frameCount)*500), 255, sin((i+frameCount)/4.)*5));//~65536?, ~256, ~256 | |
} | |
} | |
if(frameCount > 0){ | |
frameCount = -NUMPIXELS; | |
} | |
//pixels.setPixelColor(frameCount%NUMPIXELS, pixels.ColorHSV(((frameCount)*500), 255, 5));//~65536?, ~256, ~256 | |
//pixels.setPixelColor((NUMPIXELS-frameCount)%NUMPIXELS, pixels.ColorHSV(((frameCount)*500), 255, 5));//~65536?, ~256, ~256 | |
pixels.show(); | |
delay(DELAY); | |
frameCount++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment