Added Juan's code (for acceleration->flashing and temperature functions)

Also, put acceleration measurement into a single
getLinearAccelerationMagnitude() function to save code repeats.