Arduino android projets evilgenius

Page 230

The handler is then sent a message that it can add to the log field. The message is encapsulated in a class called ValueMsg. This is rather over-engineered for this application, but it is a good mechanism when receiving more structured information from the Arduino such as sensor readings. The ValueMsg class has members for an int reading and a flag that could be used to indicate the type of reading. In a more practical example, this class would be extended to include any additional data in the Arduino message.

Finally, the method “log” adds a line to the top of the log field in the app, and “alert” displays a message in a dialog.

Conclusion The Arduino side of Open Accessory is pretty easy to use; however, the Android side is considerably more complex. When it comes time to build your own Open Accessory app, a good starting point is to take the example project here, which can be downloaded from www.duinodroid.com, and modify it to suit your requirements. You may also find a project in this book that is close to what you are trying to do and modify the app to suit your needs. These projects are all based on the model used in the ADK example app provided by Google.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.