我想要做的就是編寫Arduino到Android「hello world」程序,從「Arduino開始Android ADK」開始。如何編譯Arduino ADK的hello世界程序?
下面是代碼
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
#define ARRAY_SIZE 12
AndroidAccessory acc("Manufacturer", "Model", "Description",
"Version", "URI", "Serial");
char hello[ARRAY_SIZE] = {'h','e','l','l','o',' ',
'w','o','r','l','d','!'};
void setup() {
Serial.begin(115200);
acc.powerOn();
}
void loop() {
if (acc.isConnected()) {
for(int x = 0; x < ARRAY_SIZE; x++) {
Serial.print(hello[x]);
delay(250);
}
Serial.println();
delay(250);
}
}
而且我的錯誤
C:\Users\efossum\arduino-1.0.1\libraries\UsbHost/AndroidAccessory.h: In function 'void setup()':
C:\Users\efossum\arduino-1.0.1\libraries\UsbHost/AndroidAccessory.h:68: error: 'void AndroidAccessory::powerOn()' is private
sketch_aug23a:14: error: within this context
我AndroidAccessory.h看了看,果然是私有的,但我應該怎麼改變,使這項工作?我認爲使功能pulic不是答案。
嗨,Eric。你有沒有設法編譯代碼?我試着在IDE v22和v1.0.2上編譯,使用arduino labs網站http://labs.arduino.cc/ADK/AccessoryMode從步驟1的庫。我在Windows 8和Ubuntu 12.10上嘗試過,像你一樣的錯誤。這真的令人沮喪 – androidu