1

我目前正在开展一个项目,试图让我的三星 Galaxy S2 与适用于 Android 的 Arduino Mega ADK 接口,但我遇到了一堆错误。

我已按照此处给出的指示进行操作:http ://stream.tellart.com/controlling-arduino-with-android/ 。我试过运行他们的例子

特别是“TapOn”示例(它应该允许我从我的 Android 控制连接到 Arduino 的 LED)。但是每次我运行它时,我都会在 Android 的处理代码和 arduino 代码上遇到错误。

Arduino 错误:尚未声明 AndriodAccessory

AndroidAccessory.cpp:38: error: 'AndroidAccessory' has not been declared
AndroidAccessory.cpp:43: error: ISO C++ forbids declaration of 'AndroidAccessory' with no type
AndroidAccessory.cpp: In function 'int AndroidAccessory(const char*, const char*, const char*, const char*, const char*, const char*)':
AndroidAccessory.cpp:43: error: only constructors take base initializers
AndroidAccessory.cpp: At global scope:
AndroidAccessory.cpp:54: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp: In function 'void powerOn()':
AndroidAccessory.cpp:56: error: 'max' was not declared in this scope
AndroidAccessory.cpp:57: error: 'delay' was not declared in this scope
AndroidAccessory.cpp: At global scope:
AndroidAccessory.cpp:60: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:60: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:61: error: expected ',' or ';' before '{' token
AndroidAccessory.cpp:71: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:71: error: variable or field 'sendString' declared void
AndroidAccessory.cpp:71: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:71: error: expected primary-expression before 'int'
AndroidAccessory.cpp:71: error: expected primary-expression before 'const'
AndroidAccessory.cpp:82: error: 'AndroidAccessory' is not a class or namespace
AndroidAccessory.cpp:82: error: 'byte' was not declared in this scope
AndroidAccessory.cpp:83: error: expected ',' or ';' before '{' token

Android/处理错误:来自 Android 工具内部的错误

API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.

BUILD FAILED
C:\Users\Nate\Desktop\AndriodSDK\tools\ant\build.xml:705: The following error occurred while executing this line:
C:\Users\Nate\Desktop\AndriodSDK\tools\ant\build.xml:718: Compile failed; see the compiler error output for details.

当我没有更改示例中的任何代码时,我不明白出了什么问题以及为什么会出现这些错误。此外,我可以为 arduino 和 android 独立编写程序,并且它们工作正常......我只在我希望两者相互通信时才会收到错误。

4

1 回答 1

0

看起来您的代码没有可使用的库。对我来说,这意味着在互联网上漫游,直到找到正确的库。我会尝试以下方法:

虽然如果你想在这里一步一步地尝试。

于 2012-12-07T00:37:54.873 回答