Arduino ADK + android LED blink error compilation example

I am trying to create a project using the arduino ADQ board http://arduino.cc/en/Main/ArduinoBoardADK and Android Android developer Ericsson Xperia Play running Android 2.3.4. To get started, all I want to do is blink from my Android device using the good 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 an Android application, but I have big difficulties on the arduino sketch, I can not allow import, and it will not compile on Windows7. I understand that there are some problems with the arduino IDE version. I tried to compile both of 0022, 0023 and 1.0. The further I could go with the code, I got these compilation errors after editing 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 all the documentation and I can not find a solution to my problem. Setting it up is such a pain ... I really need to do this job. Thanks in advance!:)

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

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

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

EDIT2: Again using the latest USB library from the arduino site, the code is NOT compiled. I tried compiling on IDE v22 and v1.0.2 running Windows 8 and Ubuntu 12.10 with the following errors:

 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 
+6
source share
7 answers

I think if we really know that this is EP_Record epRecord [8]; all about this can help. EP_Record was not declared in this file. Therefore, he has no type. When I gave USB_NAK_LIMIT an int type, the error went away. I don't know what type to give EP_Record? The only thing I can think of is that it could be an array of epRecord [8]; looks like an array.

While the Android developer site is useful, it lacks in many ways. One of them is online help for developers. This seems to be the only source of answers to the questions, and most of them do not really solve the problem.

0
source

The library has been 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 

I would also recommend reading this:

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

It specifically mentions that you need the CapSense library for the Android screen on the Arduino:

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

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

 sudo apt-get install avr-libc 

MAC OS X:

 fink install avr-libc avr-gcc avr-binutils avrdude 
+3
source

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

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

This way, the error messages you have with EP_RECORD will reappear if you ever upgrade to 2.0. Also check out adk.h and adk.cpp from version 2.0 on GitHub. Updated DemoKit 2.0 Example no longer uses AndroidAccessory.h / .cpp.

+2
source

It sounds like you are simply missing the USB_Host_Shield / Usb.h header that defines these constants.

+1
source

Put this code where other definitions are listed in Usb.h

 #define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted 

Put this right after SETUP_PKT typedef in Usb.h

 /* Endpoint information structure */ /* bToggle of endpoint 0 initialized to 0xff */ /* during enumeration bToggle is set to 00 */ typedef struct { byte epAddr; //copy from endpoint descriptor. Bit 7 indicates direction ( ignored for control endpoints ) byte Attr; // Endpoint transfer type. unsigned int MaxPktSize; // Maximum packet size. byte Interval; // Polling interval in frames. byte sndToggle; //last toggle value, bitmask for HCTL toggle bits byte rcvToggle; //last toggle value, bitmask for HCTL toggle bits /* not sure if both are necessary */ } EP_RECORD; 
+1
source

This seems like a problem I had some time ago. (therefore I used a micromode not ADK with USBDroid), I had to go to 3 libraries, the error message pointed me to them

// (Note: which were copied to the arduino sketch shared folder, and not to the usual place for arduino libraries). Could this be your problem?)

Then I replace wiring.h with Arduino.h in each. (Note. Make a backup of all to save some stuffing, if that is not your problem). Then copy the same thing to the folder with the name, but with the number in front of the name so when you restart the arduino software, you will get an error, ignore it and compile it.

As a result, USBdroid worked, as shown at http://www.youtube.com/watch?v=h7aa_6PNdRI Nevertheless, the work is in progress, but it made me happy. I still have a few problems to develop.

Cheers, Al

0
source
  • Install ArduinoADK BETA 001, which is the last ADK available up to date.

  • Unzip it, and in the arduino folder you will find libraries and libraries -V2.

  • If you copy the USB host in the libraries, you will get androidaccessory.h read the private error

  • Copy the USB host from the V 2 libraries, which you can successfully compile. I was.

0
source

Source: https://habr.com/ru/post/907158/


All Articles