Incorrect LED colors with BlinkM_setRGB()

Programming: A simple Arduino sketch that implements a linear brightness ramp (0 to 255), one color at a time, using BlinkM_setRGB(). At any moment, one of the colors should be ON and the other two should be OFF. Each brightness level is held for 0.5 second. Source code is below.

Problem: (1) As each ON color ramps up, I see occasional bright flashes (0.5 - 2 seconds long) of one of the OFF colors. Less frequently, both of the OFF colors flash at the same time. (2) Although the ON color follows the brightness ramp most of the time, I also see the ON color dimming, going off, or brightening for 0.5 - 1 second, after which it returns to the programmed ramp.

Other info: (1) I have two brand new BlinkM units. Both BlinkM's show the same behavior. (2) Leaving DEBUG_PRINT undefined does not affect the LED behavior.

Using Arduino Diecimilia and Arduino environment software 0011, with BlinkM plugged directly into analog pins 2-5.

-----------------------------------------------------------------------
/*
* BlinkM Linear Test
*/

#include "Wire.h"
#include "BlinkM_funcs.h"

#define BLINKM_ARDUINO_POWERED 1

#define BLINKM_ADDR 0x09
#define DELAY_MS 500

#define DEBUG_PRINT

void setup()
{
byte rc, addr;

if (BLINKM_ARDUINO_POWERED)
BlinkM_beginWithPower();
else
BlinkM_begin();

BlinkM_setAddress (BLINKM_ADDR); // comment out to not set address

Serial.begin(19200);

rc = BlinkM_checkAddress( BLINKM_ADDR );
if (rc == -1)
Serial.println("\r\nno response");
else if (rc == 1)
Serial.println("\r\naddr mismatch");

addr = BlinkM_getAddress(BLINKM_ADDR);
Serial.print("Addr=");
Serial.println(addr,DEC);
}

void loop()
{

byte r, g, b, n;
int c;

for (n=0; n<3><256>);
Serial.print(b,DEC);
Serial.println();
#endif

BlinkM_setRGB(BLINKM_ADDR, r, g, b);
delay(DELAY_MS);
}
}
}
------------------------------------------------
Sample output from serial console:

rgb=240,0,0
rgb=245,0,0
rgb=250,0,0
rgb=255,0,0
rgb=0,0,0
rgb=0,5,0
rgb=0,10,0
rgb=0,15,0
rgb=0,20,0
 
sad I’m frustrated
Inappropriate?
1 person has this problem

User_default_medium