As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Tuesday, June 10, 2014

Making the Neo Pixel Lights Work. Constance Wellman and Haley Knox

As we continued to proceed in creating our coin counter, the final stage of our building process was getting the LED lights to work. Originally we started out with five sets of Neo Pixel lights, but in the end we realized that we only need one strand to get the same effect using the least amount of power. In working with the Arduino and altering our code we first ran into the issue of creating a new code that made the lights go dark after they light up for a few seconds. The next was getting them to flash in the patterns that we wanted. After experimenting with different variations of our code we found great advice at the Adafruit Neo Pixel Library linked below. Code is posted bellow.

https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library




CODE: 
      
if (val4 > setPoint4)
{ countcheck4 = false;
}

if (count > 100)
{ strip.begin();
  strip.show();
  if (changes == 0) {
   colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(0, 0, 0), 50); // Nothing  
  strip.show();  
  changes = 1;
  }
}


if (count > 300)
{ strip.begin();
  strip.show();
  if (changes == 1) {
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(0, 0, 0), 0); // Nothing  

  strip.show();
  changes = 2;
  }
}

if (count > 500)
{ strip.begin();
  strip.show();
  if (changes == 2) {
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue 
  colorWipe(strip.Color(0, 0, 0), 0); // Nothing  
  strip.show();
  changes = 3;
  }
}

}

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

}

No comments:

Post a Comment