Hardware Reference
In-Depth Information
When the ADK application starts, the status of the SD initialization should be printed to the screen. You should
see that the SD card has been found and is ready to use. If it fails, recheck the connections or reinsert the card. When
the initialization is done, type a into the input box and press send. The text.txt file should start printing; the whole
file will be printed 80 bytes at a time. If the file size does not divide evenly by 80 bytes, the last transmission will
contain and print garbage characters in the bytes the file does not fill. This sketch's methods can be useful for pulling
logs from a sensor network or interfacing with other SPI devices, such as the Ethernet shield, with modifications to
work with the Mega-style pin out.
Summary
The world of Android-to-Arduino accessory development is now available to be further explored. Any Arduino code
that outputs through a serial connection can output to the ADK by including the AndroidAccessory.h library and
making a few changes to the serial references in any existing code.
This chapter demonstrated some of the basic workings of the Arduino Mega ADK. For further reading and more
in-depth information, check out the Android Developers web site ( http://developer.android.com ) and Beginning
Android ADK with Arduino , by Mario Böhmer (Apress, 2012).
This chapter described how to create a framework that can be used as a starting point for any Android application
that connects to an accessory device, along with a tool that is helpful for debugging. With the ADK, you can build
smarter robots, cooler blinking devices, and more dynamic art installations without having to lug around a bulky
laptop. It is even possible to develop an IDE to program other Arduinos from an Android device connected through
the Mega ADK. Aside from hardware constraints, imagination is the limit.
The software used in this chapter is sometimes a bit buggy and isn't supported on all devices because of
their relative ages. As newer Android devices become available, support will increase, making it easier to develop
accessories for a broader market. The open hardware community has done a wonderful job of adopting this new
technology, with an ever-increasing number of development boards available—from the IOIO to the Mega ADK. The
community of developers has also kept up on the software; for example, when version 1.0 of the Arduino IDE was
released, the accessory library was difficult to work with and required some changes; now the Accessory library is as
simple to work with as serial and is continually improved upon.
 
Search WWH ::




Custom Search