Problem with accelerometer

You don't initialise xa, ya, za in "loop".
Is that right?