Controlling with tilt
Modern mobile devices possess a broad variety of internal sensors for detecting and providing information about the surronding world. Though you may not have thought of them in such a way, you are certainly most familiar with the microphone and speaker that are required for making calls. There is a Wi-Fi receiver for connecting to the Internet and a camera for taking pictures. Your device almost certainly has a magnetometer to work with your GPS to provide directions.
The sensor we are interested in right now is the gyroscope. This sensor detects local rotation of the device. In general, it is used to determine the orientation of the device. We are going to use it to steer our ship. When the user tilts their device left and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access