Problem with MMA8452Q Accelorometer

I am also having real problems with this accelerometer. I am using it on a micro and the code will run for between 5 and 20 seconds and then stop, the TX light goes out and the serial window stops displaying new values. The code is attached.

I have connected the breakout as per instructions, and attached SDA/SCL as given here:

I have also tried the i2c scanner code which shows the device okay. Any ideas? Perhaps someone can suggest an alternative device which they know works well with a micro and is reliable. I need to use the micro for space considerations, so a larger board won't do.

MMA8452Q_tester.ino (5.6 KB)