




Inspiration

Coding
include
define N_LEDS 16
define PIN 1
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
}
int pos = 0, dir = 1; // Position, direction of “eye”
void loop() {
int j;
// Draw 5 pixels centered on pos. setPixelColor() will clip any
// pixels off the ends of the strip, we don’t need to watch for that.
strip.setPixelColor(pos – 2, 0x100000); // Dark red
strip.setPixelColor(pos – 1, 0x800000); // Medium red
strip.setPixelColor(pos , 0xFF3000); // Center pixel is brightest
strip.setPixelColor(pos + 1, 0x800000); // Medium red
strip.setPixelColor(pos + 2, 0x100000); // Dark red
strip.show();
delay(30);
// Rather than being sneaky and erasing just the tail pixel,
// it’s easier to erase it all and draw a new one next time.
for(j=-2; j<= 2; j++) strip.setPixelColor(pos+j, 0);
// Bounce off ends of strip
pos += dir;
if(pos < 0) {
pos = 1;
dir = -dir;
} else if(pos >= strip.numPixels()) {
pos = strip.numPixels() – 2;
dir = -dir;
}
}
Reflection
I learned a lot through this activity. First, I know how to do a complete costume. During this process, I think my sew skill is improved. Besides, I think coding actually is not very difficult, especially some basic coding. If we know the resource of coding library, it will be very convenient to do it.
Material
paper
fabric
Led
wire