Accelerometer ADXL 335

xpurexheartx:
The problem is when I put the code into the bigger code

It has happened to me a few times with different sensors, a common reason is that you are messing up the order of the functions.
If the "example" code has calibrations, or anything of that nature, make sure to place those before your void loop.

Again, posting the code will help us identify your problem.