Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

arduino ADK + android LED blink example compiling errors

I'm trying to make a project using the arduino ADK board http://arduino.cc/en/Main/ArduinoBoardADK and a Sony Ericsson Xperia Play running android 2.3.4. For starters all I want to do is blink a led from my android device, using the nice tutorial found here http://allaboutee.com/2011/12/31/arduino-adk-board-blink-an-led-with-your-phone-code-and-explanation/ .I managed to compile the android app but I'm having big difficulties on the arduino sketch, I can't resolve the imports and it won't compile on Windows7. I understand there are some arduino IDE version issues. I tried compiling both on 0022, 0023 and on 1.0. The furthest I could go with the code I was getting these compile errors after editing the AndroidAccessory.h:

D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:37: error: 'EP_RECORD' does not name a type

D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:50: error: 'EP_RECORD' has not been declared

D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:50: error: 'EP_RECORD' has not been declared

D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:64: error: 'USB_NAK_LIMIT' was not declared in this scope

I think I read the whole documentation and I can't find a solution to my problem. Setting this up is such a pain... I really need to make this work. Thank you in advance! :)

---------------------------------------------------------------------------------------------------------------------------

EDIT1: The solution which worked for me was to compile the sketch on Linux (Ubuntu)

---------------------------------------------------------------------------------------------------------------------------

EDIT2: Once again using the newest USB library from arduino website the code DOESN'T compile. I tried compiling on IDE v22 and v1.0.2 running both Windows 8 and Ubuntu 12.10 with the following errrors:

E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h: In function 'void setup()':

E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h:68: error: 'void AndroidAccessory::powerOn()' is private
sketch_jan10a:16: error: within this context

E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h: In function 'void loop()':

E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h:66: error: 'int AndroidAccessory::read(void*, int, unsigned int)' is private
sketch_jan10a:23: error: within this context
like image 307
androidu Avatar asked Jan 29 '12 14:01

androidu


3 Answers

The library was written and tested in:

Arduino Alpha 0022

Have you tried adding this to ArduinoAccessory.h?

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif 

Also I would recommend reading through this as well:

http://developer.android.com/guide/topics/usb/adk.html#installing

It specifically mentions you need the CapSense library as well for the Android shield on an Arduino:

http://www.arduino.cc/playground/Main/CapSense

It also mentions that you need to install avr-libc as well:

sudo apt-get install avr-libc

MAC OS X:

fink install avr-libc avr-gcc avr-binutils avrdude 
like image 57
fulvio Avatar answered Nov 12 '22 14:11

fulvio


EP_RECORD is defined as part of the USB Host Shield 1.0. However, it is being removed in USB Host Shield 2.0 library.

See the announcement here: http://www.circuitsathome.com/mcu/usb-host-shield-library-version-2-0-released

So the error messages you have with EP_RECORD will surface again if you ever upgrade to 2.0. Also check out the adk.h and adk.cpp from version 2.0 on GitHub. The updated DemoKit 2.0 example no longer use the AndroidAccessory.h/.cpp.

like image 31
Glorithm Avatar answered Nov 12 '22 15:11

Glorithm


Sounds to me like you're just missing the USB_Host_Shield/Usb.h header, which defines those constants.

like image 1
Zenexer Avatar answered Nov 12 '22 15:11

Zenexer