Go Down

Topic: Neopixels not working properly (Read 2242 times) previous topic - next topic

ardandfun

I have finished the code. It uploaded properly. If I move the fabric around they all light up but end up with two red Neopixels illuminated. Maybe the conductive thread is messed up? I have not been excessively gentle with the  fabric as I put it in a bag and take it with me. Since they all light up I was thinking it is the thread. Not sure?




#include <Adafruit_NeoPixel.h>
# define PIXEL_COUNT 8   //number of pixels
# define PIXEL_PIN 3    //Digital 3 pin connected to the Neopixels
Adafruit_NeoPixel strip = Adafruit_NeoPixel (PIXEL_COUNT, PIXEL_PIN, NEO_RGB + NEO_KHZ800);






void setup() {
 strip.begin();   // Initialize as  OUTPUT
 strip.clear();    // Initialize all pixels to 'off'
 strip.show();  // turn neopixels off

}

void loop() {
  // this will have the NeoPixel cycle through red,green,blue each showing for half a second
  strip.setPixelColor(3, 0, 255, 0); // set color to green
  strip.show();  // send color to NeoPixel
  delay(500);   // show color for 500 milliseconds
  strip.setPixelColor(6, 0,  0,  255);   // set color to blue
  strip.show();    // send color to neopixel
  delay(500);     // show color for 500 milliseconds
  strip.setPixelColor(1, 255, 0, 0);   // set color to red
  strip.show();   // send color to neopixel
  delay (500);   //  show color for 500  milliseconds
  strip.setPixelColor (4, 0, 0, 255);  //  set color to blue
  strip.show();   //  send color to neopixel
  delay(500);  //  show color for 500 milliseconds
  strip.setPixelColor(0, 0, 255, 0 );     //  set color to green
  strip.show();  //   send color to neopixel
  delay(500);  //  show color for 500 milliseconds
  strip.setPixelColor( 5,  255, 0,  0); //  set color to red
  strip.show();  //   send color to neopixel
  delay(500);  // show color for 500  milliseconds
  strip.setPixelColor(2, 0,0,255); //  set color to blue
  strip.show();  //  send color neopixel
  delay(500);    // show color for 500 milliseconds
  strip.setPixelColor(7,0,255,0);   // set color to green
  strip.show(); //  send color to neopixel
  delay(500); //  show color for 500milliseconds

 
}
 
 

freaklabs

If you want each individual pixel to show rather than having them light up sequentially, you would need to add a strip.clear() before each strip.show(). Also the thread has a high resistance so you might want to measure the voltage at the input to the strip. If it's too low, it might cause problems with the serial data stream. If you move it around a lot also, its possible the resistance will change, causing noise to the signal.
Good luck!
FreakLabs
Wireless Technology for the environment, wildlife, and agriculture
https://freaklabs.org
https://hackerfarm.jp
Twitter: @freaklabs

Go Up