我目前正在尝试一个项目试图让我的三星Galaxy S2与Android的Arduino Mega ADK接口,我收到了一堆错误。
我按照这里给出的指示:http://stream.tellart.com/controlling-arduino-with-android/写了这封信。我试过运行他们的examples
特别是“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编写程序,并且它们工作得很好......当我希望两者彼此通信时,我只能得到错误。
答案 0 :(得分:0)
看起来您的代码没有可以使用的库。对我来说,这意味着漫游互联网,直到找到正确的库。我会尝试以下方法:
虽然您只想尝试一步一步here。