Xiaohan’s Week 5 Assignment

A Moment for Motors

The motor one for me is not very successful. I couldn’t make the motor spin. Then I turned the NPN transistor into a different direction, the motor started to make noise but still couldn’t spin. I am not sure where it went wrong but I will read other students assignment on the website and try to figure out the problem.

Neo Pixel Strip


define PIN 6

define NUM_LEDS 4

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.show(); // Initialize all pixels to ‘off’

void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(0, 255, 255), 0); // Red
colorWipe(strip.Color(59, 60, 7), 50); // Green
colorWipe(strip.Color(0, 0, 500), 50); // Blue
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);

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 ) );

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s