I have the UNO, an accelerometer breakout board (ADXL345), all wired in and working fine.

I have the 3 legs of my RGB led connected to the PWM outputs, and then grounded through resistors.

I have converted the -ve figures from the accelerator and condensed to a 0-255 scale.

I have then set the brightness of the Red LED to the x axis, the green to the y axis and the blue to the z axis.

now, the theory is sound, that if i turn the unit 180 degrees (in one plane), the x (for instance) will change from 0-255, thus the red led should fade from off to full on, as with the other directions i should get a glowing set of colours that change as quickly (or slowly) as i turn the board.

What i get, is full on until it hits a point, and then full off with no gradual fade.

Please feel free to have a look at the code to see if it is code error.

void setup(){ // Begin by setting up the Serial Port so we can output our results. Serial.begin(9600); // Start the I2C Wire library so we can use I2C to talk to the accelerometer. Wire.begin(); // Ready an LED to indicate our status. pinMode(statusPin, OUTPUT);

// Create an instance of the accelerometer on the default address (0x1D) accel = ADXL345(); // Check that the accelerometer is infact connected. if(accel.EnsureConnected()) { Serial.println("Connected to ADXL345."); digitalWrite(statusPin, HIGH); // If we are connected, light our status LED. } else { Serial.println("Could not connect to ADXL345."); digitalWrite(statusPin, LOW); // If we are not connected, turn our LED off. } // Set the range of the accelerometer to a maximum of 2G. accel.SetRange(2, true); // Tell the accelerometer to start taking measurements. accel.EnableMeasurements();}

void loop(){ if(accel.IsConnected) // If we are connected to the accelerometer. { // Read the raw data from the accelerometer. AccelerometerRaw raw = accel.ReadRawAxis(); //This data can be accessed like so: int xAxisRawData = raw.XAxis;

// Read the *scaled* data from the accelerometer (this does it's own read from the accelerometer // so you don't have to ReadRawAxis before you use this method). // This useful method gives you the value in G thanks to the Love Electronics library. AccelerometerScaled scaled = accel.ReadScaledAxis(); // This data can be accessed like so: float xAxisGs = scaled.XAxis;

// Tell us about the this data, but scale it into useful units, take away the negatives and scale to 0-255 Serial.print(" \tScaled:\t"); Serial.print((raw.XAxis+256)/2); Serial.print(" "); Serial.print((raw.YAxis+256)/2); Serial.print(" "); Serial.print((raw.ZAxis+256)/2); Serial.println("");}