The Amarino app mentioned used in the previous post translates the sensor inputs of an Android phone ( and other events such as SMS messages) into messages sent to the Arduino via Bluetooth. In this post, I will use the orientation sensor on my phone to drive the Arduino Robot.
The orientation sensor on the Andriod platform provides yaw, pitch, and roll values of a device relative to the earth’s frame of reference (specifically, magnetic north). For more information see here. To remotely control the Robot, you can use two of the three values to (e.g. pitch and roll) to move the Robot forward and backward or right and left. I have created this Sketch to take advantage of this sensor and here is the procedure without much explanation, for now.
- Remove the Bluetooth module, attach the USB cable and upload the sketch provided above
- remove the USB cable and re-attach the BT module
- On the Android phone, use the Amarino app as described in the previous post, remove any events used before then add the Orientation Event. The events get a unique identifier based on the order they are added to the device, so the Orientation event should have ID=”A”
- Make sure sure that the app is connected to the BT and the event is enabled
- The Robot should move by changing the pitch and roll of the phone and stop when the phone is leveled horizontally