沧海笑1122 发表于 2012-10-13 02:34 
邓兄,我的手机已经刷了CM9(4.04),基带 i9100gzclp7 内核是3.0.33-cm-g6f8e729
demokit下载顺利。
现在 ...
给你一个可以打开的方法:这个名字为“城市天气预报apk(我没有改名)”支持任何android手机和google adk连接
这是需要下载的apk和arduino库:
arduino 代码如下:
//Connect an LED to D12 and a variable resistor(POT) to A0
#include <SPI.h>
#include <Adb.h>
// Adb connection.
Connection * connection;
// Elapsed time for ADC sampling. The rate at which ADC value is sent to Android device.
long lastTime;
//State of LED. Initially OFF.
uint8_t LEDState=0;
// Event handler for the shell connection.
// Any data / command to be sent to I/O of ADK has to be handled here.
//
// For eg: 1.Controlling an ouput port 2.Interacting with a device connected
// to ADK via IIC or Serial Port.
void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data)
{
// In this example Data packets contain one byte and it decides the state of a LED connected to D12
// The size of data is predetermined for this application. Android device also uses the same size.
if (event == ADB_CONNECTION_RECEIVE)
{
if(LEDState != data[0])
{
digitalWrite(9, data[0]); // Change the state of LED
Serial.println(data[0],DEC);
LEDState = data[0]; // Store the State of LED
}
}
}
void setup()
{
//Serial port debug purpose
Serial.begin(57600);
// Note start time
lastTime = millis();
// Set Digital pin 12 (LED is connected) as output
pinMode(9,OUTPUT);
// Initialise the ADB subsystem.
ADB::init();
// Open an ADB stream to the phone's shell. Auto-reconnect. Use any unused port number eg:4568
connection = ADB::addConnection("tcp:4568", true, adbEventHandler);
}
void loop()
{
//Check if ADC needs to be sampled.
if ((millis() - lastTime) > 20)
{
//Read ADC value
uint16_t data = analogRead(A0);
//Send the ADC value to Android device as two bytes of data.
connection->write(2,(uint8_t*)&data);
lastTime = millis();
}
// Poll the ADB subsystem.
ADB::poll();
}
希望这个可以帮到你 |