MAP FUNCTION AND LPD8806

Thanks for the patience and insight John.

When I run the current code here is what happens:

Red fade to Blue -abrupt jump to red fade to blue fade to red -abrupt jump to blue fade to red fade to blue -abupt jump to red fade to blue fade to red -abrupt jump to blue, it just keeps repeating.

I want a smooth fade, back and forth, like a sine wave. Thanks for any insight.

Here is my code:

#include "LPD8806.h"
#include "SPI.h"

// Example to control LPD8806-based RGB LED Modules in a strip

/*****************************************************************************/

// Number of RGB LEDs in strand:

int nLEDs = 4;

// Chose 2 pins for output; can be any valid output pins:
int dataPin = 11;
int clockPin = 13;

// Red:
#define COLOR1_R 255
#define COLOR1_G 0
#define COLOR1_B 0
// Blue:
#define COLOR2_R 0
#define COLOR2_G 0
#define COLOR2_B 255

LPD8806 strip = LPD8806(4, dataPin, clockPin);

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

// Update the strip, to start they are all 'off'
strip.show();
}

void loop() {
int r,g,b;
uint16_t i, j, k;

for (j=0; j < 100; j++) {
r = map(j, 0, 100, COLOR1_R, COLOR2_R);
g = map(j, 0, 100, COLOR1_G, COLOR2_G);
b = map(j, 0, 100, COLOR1_B, COLOR2_B);

for (i=0; i < 4; i++) {
strip.setPixelColor(i,(strip.Color(r,g,b) ));
}

strip.show(); // write all the pixels out
delay(120);
}

for (k=0; k < 100; k++) {
r = map(k, 0, 100, COLOR2_R, COLOR1_R);
g = map(k, 0, 100, COLOR2_G, COLOR1_G);
b = map(k, 0, 100, COLOR2_B, COLOR1_B);

for (i=0; i < 4; i++) {
strip.setPixelColor(i,(strip.Color(r,g,b) ));
}
strip.show();
delay(120);
}
}