Show Posts
Pages: 1 [2] 3 4 ... 6
16  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: March 09, 2012, 01:27:12 pm
So I screwed up the two 5M strips I bought.  Totally my fault.  I put my power supply in series mode to get more from it but didn't adjust the voltage prior to pushing the button.  I fried the strip and my arduino!

The second strip was after adjusting my voltage down to 5v but not realizing (nor was it well documented) that the display showed only 1/2 of the voltage in each so in actuality I was feeding 10v to the strip.  GRRRRRRRR.  Another strip fried but the arduino survived.  I didn't realize what was going on until I put a meter to the output of the power supply.

So now I have 10M of the LPD8806 strip that doesn't work.  Another project for myself is to fix these at some point.  I already have plenty of ICs and plenty of 5050 RGB LEDs but have to figure out how to isolate the bad chips and replace just those.  Fun, fun.

In the meantime, I ordered and received another 25M of these strips (5 - 5M spools).  I got these all tested out and they are working great.  I also hooked up two in series (both strips powered from both ends but data lines fed from one to the other) and the arduino controlled all 320 lights with no problem in any of my lighting routines.

I also bought a 20A, 5V power supply from eBay that is powering both strips very well. smiley

Anyhow, I was thinking of selling some of the latest order if anyone is interested.  It would be the exact same as what is bought off Adafruit but cost much less.  Not sure if I'll just throw them on eBay by the spool or by the meter yet.

17  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: February 25, 2012, 04:32:07 pm
I took a chance and purchased 20m of LPD8806 based LED strip from a China manufacturer.  I had to do a wire transfer of funds and was very hesitant to do so since I have very little recourse if the product was sub-standard, didn't operate like I expected or I never received it. 

But I was pleasantly surprised at the results.  These are the exact same strips found on Adafruit for less than 1/2 of the cost. smiley

I have one of the two strips running with the same code I used from my previous project using the 2m I bought from Adafruit.  I need to get a PC power supply rigged up to provide more amperage to run all 320 RGB LEDs on both strips and get my office lighting project built.

The company I ordered from is http://www.gree-leds.com/.
18  Using Arduino / LEDs and Multiplexing / Re: Ledstrip not evenly coloured on: February 23, 2012, 03:48:57 pm
Nice.  What are you using to control it with a browser?

I have 4 - 5m white led strips in my office to replace the florescent lights and am waiting on 2 -5m RGB led strips (LPD8806 based) to add some color.  I plan on controlling the color strips wirelessly using xbee.
19  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LedCube; shorten POV code on: February 23, 2012, 12:08:24 am
For starters, you should shift your code over to use interrupts and store your cube data in an array.  You will get much better performance this way and it will be easier to program. 

The array will be an image of the cube in memory and you just change the array values for what you want to display.  The interrupt routine runs on its own and continuously cycles through the array to turn on and off the LEDs.  You can then write your routines using X & Y type addressing where X could represent a level of your cube and Y could represent a row on that level.  The value of Y would set which of the 3 leds on that row would be on or off (ie. 000 = all off 010 = middle on and 111 = all on)

Here is the code I used with several effects for my 4x4x4 cube: http://www.2shared.com/file/jdgOMlr5/Cube_4x4x41.html

Within the code you will see some arrays like this:
Code:
const unsigned char spinning_line[6][2] PROGMEM =
{
  { 0x84, 0x21 },
  { 0x0c, 0x30 },
  { 0x03, 0xc0 },
  { 0x12, 0x48 },
  { 0x22, 0x44 },
  { 0x44, 0x22 },
};
These set the LEDs on or off using bits mentioned above (0=off, 1=on).  Each Hex number is 8 bits and represents 2 rows of 4 leds.  By adapting the code to use your 3x3x3 cube,  you then just load up the cube array with these values and your cube will display the pattern.  If you don't know much about programming like this, it will be a bit of a learning curve.  It certainly was with me.

You could also try to use the code for the 3x3x3 cube here: http://arduino.cc/playground/Main/LEDCube3x3
It doesn't use interrupts but it does use bits to determine on and off states.
20  Using Arduino / LEDs and Multiplexing / Re: Ledstrip not evenly coloured on: February 22, 2012, 11:39:06 pm
Good deal.  How about some pics or a video? smiley
21  Using Arduino / LEDs and Multiplexing / Re: controlling GU10 bulbs on: February 21, 2012, 11:45:05 pm
I will being doing something similar with a GU10 tracklight.  The GU10 bulbs are 110V halogen and the tracklight is dimable using a standard wall dimmer.  But the project will replace the 4 bulbs with 3W RGB LEDs that will be arduino controlled.  But to do this, I have to gut each of the housings and run wires in the track to the arduino that will be housed in the ceiling and powered by a 5V transformer.  The arduino will then control the colors/intensity of the bulbs by PWM signals to MOSFETs that power the LEDs. 

Is this similar or are you starting with something different?
22  Using Arduino / LEDs and Multiplexing / Re: Automatic Room Light Intensity Control System on: February 21, 2012, 11:38:13 pm
I built something similar for under and over cabinet lighting for my kitchen.  It uses a PIR for movement detection to turn on the lights when movement is detected in the kitchen but the light sensor is only used for detecting ambient light to determine whether or not the lights need to be turned on.  It won't turn them on during the day or if the kitchen lights are on.  And if they are on then the kitchen lights are turned on, it will fade them out.  The code is very simple.

Code:
#define ledPin 5        // Top LED strip
#define ledPin1 6       // Middle LED strip
#define ledPin2 9       // Bottom LED strip
#define analogPin A0    // potentiometer connected to input 0
#define motionSensor A1 // motion sensor connected to input 1
#define lightPin A2     // Light sensor connected to input 2
#define lightThresh 15 // Light threshold
#define maxbright 255
int motion = 0;         // variable to store the read value
int curLight = 0;       //current light level
void setup()
{
  pinMode(ledPin, OUTPUT);   // sets the pin as output
  pinMode(ledPin1, OUTPUT);   // sets the pin as output
  pinMode(ledPin2, OUTPUT);   // sets the pin as output
  Serial.begin(9600);
}

void loop()
{
//  analogWrite(ledPin, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  if (analogRead(motionSensor)>0 && analogRead(lightPin) < lightThresh) {
    turnon();
    delay(1000);
    while(analogRead(motionSensor)>0 && analogRead(lightPin)<(lightThresh+15)){
      delay(200);
      Serial.println(analogRead(lightPin));
    }
    turnoff();
  }
      Serial.println(analogRead(lightPin));
}

void turnon(){
  for (int i =0; i<maxbright; i++){
    analogWrite(ledPin, i);
    analogWrite(ledPin1, i);
    analogWrite(ledPin2, i);
      Serial.println(analogRead(lightPin));
    delay(25);
  }
}

void turnoff(){
  for (int i =maxbright; i>=0; i--){
    analogWrite(ledPin, i);
    analogWrite(ledPin1, i);
    if (i<25) analogWrite(ledPin2, i);
    delay(35);
  }
}
23  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LedCube; shorten POV code on: February 21, 2012, 11:32:03 pm
Without a good explanation, it will be hard to help.  It also depends on how you have you multiplexing set up.  I built a 4x4x4 and 5x5x5 cube and control it using multiplexing. http://arduino.cc/forum/index.php/topic,74574.msg562027.html#msg562027

Are you trying to light an outside square on one level then shift it up and down? 
24  Using Arduino / LEDs and Multiplexing / Re: Ledstrip not evenly coloured on: February 21, 2012, 11:25:26 pm
Do you have 8 meters of light strip being powered from just one end?  This would cause an issue with too much voltage drop.  For 8 meters, you should have power from both ends and one in the middle to ensure even power distribution.

But as stated, without knowing more details about your strip and how you have it wired, it is hard to give concrete suggestions.
25  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: January 19, 2012, 12:45:02 am
Glad to help.  Helps me learn more about it as well.

As I understand it:
When data is sent down the line, an IC will fill its buffer then start shifting data to the data out line regardless of whether there is actually another IC after it.  Once the data transfer has been completed, it will then send up to 3 bytes of zeros to tell the ICs to latch the output pins.  There is no unlatch command.  It will then automatically start accepting SPI data again to fill the buffers of the ICs.
26  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: January 18, 2012, 03:31:39 pm
The library does keep track of how many pixels (or leds) you have with the statement:
Code:
#define stripSize 64
It then initializes the interrupt to use this in this statement:
Code:
LPD8806 strip = LPD8806(stripSize);

If you want to get into the nitty gritty, look at the LPD8806.cpp file.  It breaks up the data to send to the ICs and then latches it in to display.  ICs in series have information overflow from one IC to the next on the data and clock pins to allow these long runs.

Hope this helps a bit...
27  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: January 17, 2012, 11:08:24 am
2nd part

Code:
void ran1(int dly){
    int r = random()%128;
    int g = random()%128;
    int b = random()%128;
    int start = random()%stripSize;
    if (random()%2 == 0){
      for (int i = 0+start; i < stripSize+start; i++){
       strip.setPixelColor(i%stripSize, r,g,b);
       strip.show();
       if (butPush == 0) delay(dly);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = stripSize;
        }
     }
    }
   else {
      for (int i = stripSize+start; i >=0+start; i--){
       strip.setPixelColor(i%stripSize, r,g,b);
       strip.show();
       if (butPush == 0) delay(dly);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 0;
        }
     }
    }
}
void ran(int dly){
  while (digitalRead(button)==0){
    strip.setPixelColor(random()%stripSize+1,random()%128,random()%128,random()%128);
    strip.show();
    delay(dly);
  }
  butPush = 1; 
}
void allon(){
    for (int i = 0; i < stripSize; i++){
     strip.setPixelColor(i, 127, 127,127);
   }
   strip.show();
//   delay(1000);
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
//    for (int i = 0; i < stripSize; i++){
//     strip.setPixelColor(i, 0, 0,0);
//   }
//   strip.show();
//   delay(1000);
//  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
}
void circlinglights(int dly){
  int b=0;
  int r=63;
  while (digitalRead(button)==0){
    strip.setPixelColor(b,0,0,2);
    strip.setPixelColor((b+1)%stripSize,0,0,9);
    strip.setPixelColor((b+2)%stripSize,0,0,16);
    strip.setPixelColor((b+3)%stripSize,0,0,40);
    strip.setPixelColor((b+4)%stripSize,0,0,55);
    strip.setPixelColor((b+5)%stripSize,0,0,80);
    strip.setPixelColor((b+6)%stripSize,0,0,127);
    strip.setPixelColor(r,2,0,0);
    strip.setPixelColor((r+stripSize-1)%stripSize,9,0,0);
    strip.setPixelColor((r+stripSize-2)%stripSize,16,0,0);
    strip.setPixelColor((r+stripSize-3)%stripSize,40,0,0);
    strip.setPixelColor((r+stripSize-4)%stripSize,55,0,0);
    strip.setPixelColor((r+stripSize-5)%stripSize,80,0,0);
    strip.setPixelColor((r+stripSize-6)%stripSize,127,0,0);
    strip.show();
    delay(dly);
    strip.setPixelColor(b,0);
    strip.setPixelColor(r,0);
    strip.show();
    if (b++==stripSize) b=0;
    if (r--==0) r=stripSize-1;
  }
  butPush = 1;
}

void caution(int dly){
  while(butPush==0){
    for (int i = 0; i<stripSize; i++){
       strip.setPixelColor(i, 127, 90,0);
        if (digitalRead(button)){
          butPush = 1;   //Was the button pushed to change modes?
          i = stripSize;
        }
    }
    if (butPush == 0) {strip.show(); delay(dly);}
    for (int i = 0; i<stripSize; i++){
       strip.setPixelColor(i, 0, 0,0);
        if (digitalRead(button)){
          butPush = 1;   //Was the button pushed to change modes?
          i = stripSize;
        }
    }
    if (butPush == 0) {strip.show(); delay(dly);}
  }
}
void police(int dly){
  for (int x = 0; x<2; x++){
    for (int i = 0; i < 25; i++){
     strip.setPixelColor(i, 127, 0,0);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 32;
        x = 2;
      }
    }
    for (int i = 57; i < 64; i++){
     strip.setPixelColor(i, 127, 0,0);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 32;
        x = 2;
      }
   }
   strip.show();
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
  if (butPush == 0) delay(dly);
    for (int i = 0; i < 25; i++){
     strip.setPixelColor(i, 0, 0,0);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 32;
        x = 2;
      }
    }
    for (int i = 57; i < 64; i++){
     strip.setPixelColor(i, 0, 0,0);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 32;
        x = 2;
      }
    }
    strip.show();
  if (butPush == 0) delay(dly);
  }
  for (int x = 0; x<2; x++){
    for (int i = 25; i < 57; i++){
     strip.setPixelColor(i, 0, 0,127);
   }
   strip.show();
  if (butPush == 0) delay(dly);
    for (int i = 25; i < 57; i++){
     strip.setPixelColor(i, 0, 0,0);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = 64;
        x = 2;
      }
    }
    strip.show();
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
  if (butPush == 0) delay(dly);
  }
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
}

void music(int all){
  micLevel = ((analogRead(A0)+analogRead(A2)))%1024; //read the pot value and add it to the microphone value to allow color shifting
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?
  //colorLevel = (micLevel%768)/2;
  colorLevel = micLevel%384; //adjust colorLevel with the color wheel spectrum
  numLeds = map(micLevel,200,600,0,stripSize); //Adjust adjust the most use of LEDs
 
  if (all) numLeds = stripSize;
  for (int i = 0; i < numLeds; i++){
    strip.setPixelColor(i, Wheel((i+colorLevel)%384));
  } 
  delay(map(analogRead(A1),0,1024,0,250));
  strip.show();
    for (int i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, 0);  // turn all pixels off
    }
  if (digitalRead(button)) butPush = 1;   //Was the button pushed to change modes?

}

void rainbow(uint8_t wait) {
  int i, j;
   
  for (j=0; j < 384; j++) {     // 3 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel( (i + j) % 384));
      if (digitalRead(button)) {
        butPush = 1;   //Was the button pushed to change modes?
        j=384;
      }
    } 
    strip.show();   // write all the pixels out
    if (butPush == 0) delay(wait);
  }
}

// Slightly different, this one makes the rainbow wheel equally distributed
// along the chain
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;
 
  for (j=0; j < 384 * 5; j++) {     // 5 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      // tricky math! we use each pixel as a fraction of the full 384-color wheel
      // (thats the i / strip.numPixels() part)
      // Then add in j which makes the colors go around per pixel
      // the % 384 is to make the wheel cycle around
      strip.setPixelColor(i, Wheel( ((i * 384 / strip.numPixels()) + j) % 384) );
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        j=384*5;
      }
    } 
    strip.show();   // write all the pixels out
    if (butPush == 0) delay(wait);
  }
}

// fill the dots one after the other with said color
// good for testing purposes
void colorWipe(uint32_t c, uint8_t wait) {
  int i;
 
  for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      if (butPush == 0) delay(wait);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = strip.numPixels();
      }
  }
}

// Chase a dot down the strip
// good for testing purposes
void colorChase(uint32_t c, uint8_t wait) {
  int i;
 
  for (i=0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, 0);  // turn all pixels off
  }
 
  for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      if (i == 0) {
        strip.setPixelColor(strip.numPixels()-1, 0);
      } else {
        strip.setPixelColor(i-1, 0);
      }
      strip.show();
      if (butPush == 0) delay(wait);
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = strip.numPixels();
      }
  }
}

/* Helper functions */

//Input a value 0 to 384 to get a color value.
//The colours are a transition r - g -b - back to r

uint32_t Wheel(uint16_t WheelPos)
{
  byte r, g, b;
  switch(WheelPos / 128)
  {
    case 0:
      r = 127 - WheelPos % 128;   //Red down
      g = WheelPos % 128;      // Green up
      b = 0;                  //blue off
      break;
    case 1:
      g = 127 - WheelPos % 128;  //green down
      b = WheelPos % 128;      //blue up
      r = 0;                  //red off
      break;
    case 2:
      b = 127 - WheelPos % 128;  //blue down
      r = WheelPos % 128;      //red up
      g = 0;                  //green off
      break;
  }
  return(strip.Color(r,g,b));
}
28  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: January 17, 2012, 11:07:36 am
Code:
#include "LPD8806.h"
#include "SPI.h"

#define button 8
#define stripSize 64
int butPush = 0;
int currentMode = 17;
int numModes = 17;

// on Arduino 168/328 thats data = 11, and clock = pin 13
LPD8806 strip = LPD8806(stripSize);

void setup() {
  // Start up the LED strip
  strip.begin();

  // Update the strip, to start they are all 'off'
  strip.show();
//  Serial.begin(9600);
  pinMode(button,INPUT);
}
int micLevel;
int colorLevel;
int numLeds;

void loop() {
  if (butPush){
    if (currentMode++==numModes) currentMode = 3;
    butPush=0;
    while (digitalRead(button)==1){
      //don't do anything else until the button is released
    }
    for (int i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, 0);  // turn all pixels off
    }
    strip.show();
    delay(250);
  }
  modeSelect();
}

void modeSelect(){
  switch (currentMode){
    case 1:
      music(0);  //sound sensitive mode with variable LEDs lit
      break;
    case 2:
      music(1);  //sound sensitive mode with ALL LEDs lit
      break;
    case 3:
      colorChase(strip.Color(127,0,0), 20);  // full brightness red
      colorChase(strip.Color(127,127,0), 20); // orange
      colorChase(strip.Color(0,127,0), 20); // green
      colorChase(strip.Color(0,127,127), 20); // teal
      colorChase(strip.Color(0,0,127), 20); // blue
      colorChase(strip.Color(127,0,127), 20); // violet
      break;
    case 4:
      // fill the entire strip with...
      colorWipe(strip.Color(127,0,0), 40); // red
      colorWipe(strip.Color(0, 127,0), 40); // green
      colorWipe(strip.Color(0,0,127), 40); // blue
      break;
    case 5:
      rainbow(25);
      break;
    case 6:
      rainbowCycle(0);  // make it go through the cycle fairly fast
      break;
    case 7:
      caution(600);  //flash red and blue
      break;
    case 8:
      police(115);  //flash yellow
      break;
    case 9:
      circlinglights(20);  //flash yellow
      break;
    case 10:
      allon();  //all white
      break;
    case 11:
      ran(20);  //random lights
      break;
    case 12:
      ran1(15);  //random lights
      break;
    case 13:
      shiftwhite(100);
      break;
    case 14:
      kit(1);
      break;
    case 15:
      rand2(50);
      break;
    case 16:
      allon1(50); // white flicker
      break;
    case 17:
      xmas(300);
      break;
  }
}
void xmas(int dly){
  int color=0;
  while (butPush==0){
    for (int i=0; i<stripSize; i++){
      if (digitalRead(button)==1) {butPush=1; i=stripSize;}
      if (color==4){
        strip.setPixelColor(i,127,127,127); //white
      }
      else if (color==3){
        strip.setPixelColor(i,127,90,0); //yellow
      }
      else if (color==2){
        strip.setPixelColor(i,0,0,127); //blue
      }
      else if (color==1){
        strip.setPixelColor(i,0,127,0); //green
      }
      else {
        strip.setPixelColor(i,127,0,0); //red
      }
      if (color++==4) color=0;
    }
    if (butPush==0){
      strip.show();
      delay(dly);
    }
  }
}
void allon1(int dly){
  while (digitalRead(button)==0){
    int red = random()%128;
    int green = random()%128;
    int blue = random()%128;
    for (int i = 0; i < stripSize; i++){
     strip.setPixelColor(i, red, green, blue);
   }
   strip.show();
   delay(dly);
    for (int i = 0; i < stripSize; i++){
     strip.setPixelColor(i, 0,0,0);
   }
   strip.show();
   delay(dly);
  }
  butPush = 1;
}
void rand2(int dly){
  //turn on lights one at a time with the same random color
  //ensure that a light is turned on each cycle
  //then turn off the lights 2 at a time
  int lights[stripSize];
  for (int i=0; i<stripSize; i++) lights[i]=0;
  while (digitalRead(button)==0){
    int red = random()%128;
    int green = random()%128;
    int blue = random()%128;
    for (int i = 0; i < stripSize; i++){
      int turnon=0;
      while (turnon==0){
        if (digitalRead(button)==1) {i=stripSize; butPush=1;}
        int x = random()%stripSize;
        if (lights[x]==0){
          turnon=1;
          lights[x]=1;
          strip.setPixelColor(x,red,green,blue);
          strip.show();
        }
      }
    if (butPush==0) delay(dly);
    }
  if (butPush==0)   delay(2000);
    for (int i = 0; i < stripSize; i++){
      int turnoff=1;
      while (turnoff==1){
        if (digitalRead(button)==1) {i=stripSize; butPush=1;}
        int x = random()%stripSize;
        if (lights[x]==1){
          turnoff=0;
          lights[x]=0;
          strip.setPixelColor(x,0,0,0);
          strip.show();
        }
      }
    if (butPush==0) delay(dly);
    }
  }
}
void kit(int dly){
  int lmin=0; int lmax=16; int lx=1; int lcur=lmin;
  int rmin=32; int rmax=48; int rx=1; int rcur=rmin;
  int bmin=50; int bmax=62; int bx=0; int bcur=bmax;
  int fmin=18; int fmax=30; int fx=0; int fcur=fmax;
  int wlev=8;
  int lrticks=6; //number of times to loop through before moving the leds
  int fbticks=8; //number of times to loop through before moving the leds
  int tick=1;
   for (int i=lmin; i<lmax; i++){
     strip.setPixelColor(i,wlev,wlev,wlev);
   }
   for (int i=rmin; i<bmax; i++){
     strip.setPixelColor(i,wlev,wlev,wlev);
   }
  while (digitalRead(button)==0){
     for (int i=0; i<2; i++){
       //calculate brightness level for position.  Closer to the center is brighter
       //turn on 2 leds at a time
//       strip.setPixelColor(lcur+i,127/abs(((lmax-lmin)/2)-lcur),0,0);
//       strip.setPixelColor(rcur+i,127/abs(((rmax-rmin)/2)-(rcur-rmin)),0,0);
//       strip.setPixelColor(bcur+i,127/abs(((bmax-bmin)/2)-(bcur-bmin)),0,0);
//       strip.setPixelColor(fcur+i,127/abs(((fmax-fmin)/2)-(fcur-fmin)),0,0);
       strip.setPixelColor(lcur+i,127,0,0);
       strip.setPixelColor(rcur+i,127,0,0);
       strip.setPixelColor(bcur+i,127,0,0);
       strip.setPixelColor(fcur+i,127,0,0);
     } 
     strip.show();
     delay(dly);
     strip.show();
     if (tick%lrticks==0){ //Do we need to change the position?
       for (int i=0; i<2; i++){
         //turn the 2 leds back to white
         strip.setPixelColor(lcur+i,wlev,wlev,wlev);
         strip.setPixelColor(rcur+i,wlev,wlev,wlev);
       } 
       if (lx==1) lcur++;  //increment or decrement the position
       else lcur--;
       if (lcur>=lmax) lx=0; //Are we at the max?
       if (lcur<=lmin) lx=1; //Are we at the min?
       if (rx==1) rcur++;  //increment or decrement the position
       else rcur--;
       if (rcur>=rmax) rx=0; //Are we at the max?
       if (rcur<=rmin) rx=1; //Are we at the min?
     }
     if (tick%fbticks==0){ //Do we need to change the position?
       for (int i=0; i<2; i++){
         //turn the 2 leds back to white
         strip.setPixelColor(bcur+i,wlev,wlev,wlev);
         strip.setPixelColor(fcur+i,wlev,wlev,wlev);
       } 
       if (bx==1) bcur++;  //increment or decrement the position
       else bcur--;
       if (bcur>=bmax) bx=0; //Are we at the max?
       if (bcur<=bmin) bx=1; //Are we at the min?
       if (fx==1) fcur++;  //increment or decrement the position
       else fcur--;
       if (fcur>=fmax) fx=0; //Are we at the max?
       if (fcur<=fmin) fx=1; //Are we at the min?
     }
     if (tick++==lrticks*fbticks) tick=1;
  }
  butPush = 1;
}
void shiftwhite(int dly){
  for (int o = 0; o < stripSize; o++){
    for (int i = 0; i <stripSize; i=i+5){
      strip.setPixelColor((i+o)%stripSize, 127,127,127); 
//      strip.setPixelColor((i+1+o)%stripSize, 127,127,127); 
      strip.setPixelColor((i+2+o)%stripSize, 0,127,0); 
      strip.setPixelColor((i+3+o)%stripSize, 0,127,0); 
      strip.setPixelColor((i+4+o)%stripSize, 0,127,0); 
      strip.setPixelColor((i+5+o)%stripSize, 0,127,0); 
      if (digitalRead(button)){
        butPush = 1;   //Was the button pushed to change modes?
        i = stripSize;
        o = stripSize;
        }
    }
    strip.show();
    if (butPush == 0) delay(dly);
  }
}

29  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: January 17, 2012, 10:38:58 am
Very useful.  Now let's get some video of the strip.  smiley

I did a wheelchair project with the 2m I had and put together some basic sequences...17 in all.  If you'd like any of the animations in the video, let me know....


30  Using Arduino / LEDs and Multiplexing / Re: My RGB LED Stairs Illumination video on: January 16, 2012, 12:13:19 pm
Thanks.

I have not made any more changes since my last update; however, I am going to be changing out the pressure pads to switch to an infrared beam soon.  The pressure pads work great but over time start to move around and the sensitivity decreases with repeated use.   

The transition to IR is going to require a couple of addition circuits to be added but I shouldn't have to redo what I have.  I plan on using a couple of 555 ICs to modulate the IR emitter so the receiver can accurately detect the beam.  The only downside to this is that the IR emitters are power hungry as compared to the pressure sensors with each drawing up to 50mA.  This will result in an additional $0.50/yr of electricity usage.  But I think I can live with that. smiley-wink
Pages: 1 [2] 3 4 ... 6