The Lumia 640 doesn't have a gryroscope. What the phone uses to determine orientation (such as tilt) is an accelerometer - the Lumia 640 has this, along with other sensors (Sensors: Ambient light sensor, Proximity sensor, Magnetometer (digital compass), SensorCore). Have you tried any of the following?
1. restarting your phone
2. performing a soft reset
3. performing a hard reset/re-installing the OS through Lumia software recovery tool - maybe needed if some internal drivers for those sensors are corrupted for some reason
4. bringing your phone to a service center on the grounds of hardware failure (the sensors are hardware components)