How to tell if an Android device has Open Accessor

2020-04-30 02:40发布

Does anyone know how to check for this? I just bought a Samsung Galaxy Tab 2 (7" version running Android 4.0.3) with the intention of using it to connect to my Arduino Mega ADK board. But I am unsure if the galaxy tab has the necessary Open Accessory Mode listed here: http://developer.android.com/guide/topics/usb/adk.html

It seems that just because the software is right doesn't mean that the device is compatible and this varies per manufacture. Since this is a new tablet I am not finding anything. Any help?

5条回答
爷的心禁止访问
2楼-- · 2020-04-30 02:50

I don't know how you can find out if your device has this ADK mode (I failed trying to follow that lead when trying to get my stuff set up.) But here are a few gotchas I figured out:

make sure you are using Arduino IDE v1.0, I was trying 23 for a while. But you must use the newset one.

I also had to edit the sketch in order to get it working. Here was my new setup method. I just added some print statements so I could tell which portion it was failing at. It turned out for me the init_joystick ( 5 ); call was where it was dying. I commented that out and all went well.

void setup()
{
    Serial.begin(115200);
    Serial.print("\r\nStart");

    init_leds();
        Serial.print("\r\nDone LED");
    init_relays();
        Serial.print("\r\nDone Relay");
    init_buttons();
        Serial.print("\r\nDone button");
    //init_joystick( 5 );


    // autocalibrate OFF
    touch_robot.set_CS_AutocaL_Millis(0xFFFFFFFF);

    servos[0].attach(SERVO1);
    servos[0].write(90);
    servos[1].attach(SERVO2);
    servos[1].write(90);
    servos[2].attach(SERVO3);
    servos[2].write(90);


    b1 = digitalRead(BUTTON1);
    b2 = digitalRead(BUTTON2);
    b3 = digitalRead(BUTTON3);
    //b4 = digitalRead(JOY_SWITCH);
    c = 0;

    acc.powerOn();
        Serial.print("\r\nDone Setup");
}

This change to the Setup method in the ADK demokit sketch allowed the connection to be registered and for the app to do its other nifty things.

However, I only tested on devices that I knew supported the ADK :

  • Galaxy Nexus
  • Nexus S
  • Motorola Xoom

You will have to provide sufficient power to the ADK device - at least Nexus S can be unstable when the ADK device is powered from a USB hub. Telltale signs are ADK mode flaking out for no apparent reason.

查看更多
孤傲高冷的网名
3楼-- · 2020-04-30 02:51

I have a Samsung Galaxy Tab 2 (7" version running Android 4.0.3) and an Android Accessory that works with at least 3 other device, but not on the Tab. Perhaps it is because it is broken in 4.0.3 (as with the Nexus S wherein 4.0.3 is broken but 4.0.4 is not). In addition, 2.3.4+ running on other Samsung devices has the USB accessory library stripped out.

查看更多
Anthone
4楼-- · 2020-04-30 02:53

I just got my Samsung Galaxy Tab 2 with a 7 inch screen. It is running Android 4.0.3 and I can get it to work with the Arduino Mega ADK! I am running the Arduino 0023 interface for compiling the code. The Arduino 1.0 interface broke too many libraries so I switched to the older interface. Comment out the line "init_joystick( 5 );" if you do not have a shield. I could verify that the waveforms for the 3 servos were correct using an oscilloscope.

If you still can't get it to work try commenting out any code related to the joystick since it's probably hanging on the I2C communications. Otherwise, go to the dfrobot website and order an ADK shield for around $60 so that the Joystick is read properly. That's my next step.

Update: noticed that the update rates to the tablet were really slow. Fix was to comment out this line if you don't have a shield:

//touchcount = touch_robot.capSense(5);

The touch device is attached to the serial lines so I'm assuming that not having one is causing a long delay due to a timeout.

查看更多
小情绪 Triste *
5楼-- · 2020-04-30 02:55

Add Galaxy Nexus to the list.

Nexus S ICS 4.0.4 works, 4.0.3 is broken.

Make sure power is sufficient - at least Nexus S will flake out and intermittently stop seeing the ADK board if the board + phone tandem is powered from a USB hub.

查看更多
相关推荐>>
6楼-- · 2020-04-30 03:01

The issue with capsense is becasue capsense does not exist! You need to add the CapacitiveSensor.h to the project then change all referance to capsense to CapacitiveSensor to cure those bugs (arduino ide 1.5.2). Still can get a connection.(4.1.3) and im wondering if like the SExperia mini pro and need a docking station.

查看更多
登录 后发表回答