How to read a MMA7455L using SPI?

Things to try:

  1. Slow down the SPI clock in case you are trying to go too fast. The default is the 16 MHz clock frequency divided by 4, or 4 MHz. You definitely don't need it that fast. Try calling SPI.setClockDivider(SPI_CLOCK_DIV128); after you initialize the SPI port. You can always go to lower dividers later to speed up the SPI clock once the system is debugged.

  2. Your SPI transfers to get accelerometer data don't look right. Have a look at Figure 11 in the datasheet. You need TWO SPI transfers to read ONE value. The first byte sent sends the read command, then you have to send another byte to actually get the data from the accelerometer:

    byte valueX,valueY,valueZ;
   digitalWrite(pinCS, LOW);
   (void) SPI.transfer(xout);
   valueX = SPI.transfer(0 /*don't care value*/);
   digitalWrite(pinCS, HIGH);

   digitalWrite(pinCS, LOW);
   (void) SPI.transfer(yout);
    valueY = SPI.transfer(yout);
   digitalWrite(pinCS, HIGH);

etc.

  1. Finally, I think your xout/yout/zout values need to be shifted left by 1 bit since the read command is a 1-bit read/write flag, a 6-bit register address (what you currently have), then a 1-bit don't-care bit to make 8 bits:
const byte xout = 0x06<<1;             // X-Axis value register is $06
const byte yout = 0x07<<1;             // Y-Axis value register is $07
const byte zout = 0x08<<1;             // Z-Axis value register is $08

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons