Mia’s week5 homework

include

define PIN 6

define NUM_LEDS 8

define BRIGHTNESS 50

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct if colors are swapped upon testing
// NEO_RGBW Pixels are wired for RGBW bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);

void setup() {

strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(220, 0, 0), 150); // Red
colorWipe(strip.Color(0, 150, 87), 20); // Green
colorWipe(strip.Color(0, 199, 25), 20); // Blue
colorWipe(strip.Color(0, 89, 0, 25), 50); // White

Joey’s 5 week assignment

A Moment for Motors

Neo Pixel Strip

CODE

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct if colors are swapped upon testing
// NEO_RGBW Pixels are wired for RGBW bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);

void setup() {

strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
// Some example procedures showing how to display to the pixels:

colorWipe(strip.Color(59, 60, 7), 50); // Green
colorWipe(strip.Color(0, 0, 500), 50); // Blue

colorWipe(strip.Color(0, 255, 255), 0); // Red
colorWipe(strip.Color(0, 0, 0, 0), 50); // White

}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

void pulseWhite(uint8_t wait) {
for(int j = 0; j < 256 ; j++){
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, strip.Color(0,0,0, j ) );
}
delay(wait);
strip.show();
}

Shuyi’s week5 homework

include

define PIN 6

define NUM_LEDS 8

define BRIGHTNESS 50

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct if colors are swapped upon testing
// NEO_RGBW Pixels are wired for RGBW bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);

void setup() {

strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {

int a = random(0,30);

customFunction(strip.Color(a,0, 0),100);
customFunction(strip.Color(0,2a, 0),100); customFunction(strip.Color(0,0, 3a),100);
customFunction(strip.Color(4a,0, 0),100); customFunction(strip.Color(0,5a, 0),100);
customFunction(strip.Color(0,0, 6a),100); customFunction(strip.Color(7a,7a, 0),100); customFunction(strip.Color(8a,8a, 8a),100);

}

void customFunction(uint32_t c, uint8_t wait){
//for(uint16_t i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(random(1,8), c);
strip.show();
delay(wait);
//}
}