code for gravity sensor added, but dunno if in the proper place.