How to acquire analog values into my android APP

Discussion in 'Android' started by Tannyveer, Mar 2, 2015.

  1. Tannyveer

    Tannyveer New Member

    Joined:
    Feb 19, 2014
    Messages:
    33
    Likes Received:
    0
    Hello,
    I am try to acquire analog voltage through my android app. I connected potentiometer A0 pin of the UDOO Quad board and wrote the arduino sketch was

    String stringOne = String(analogRead(A0), DEC); // read the analog volatge
    stringOne.getBytes(buf,sizeof(buf)); convert into the byte array

    if (adk.isReady()){
    adk.write(sizeof(buf),buf);//sent the usb serial.

    and the android APP Code is:

    public void blinkLED(View v) {
    TextView txt = (TextView) findViewById(R.id.textView);
    if (buttonLED.isChecked()) {
    buttonLED.setBackgroundColor(Color.RED);
    txt.setText(mAdkManager.readSerial());
    }
    else {
    buttonLED.setBackgroundColor(Color.GREEN);
    txt.setText("Not Connected");
    }
    }
     

Share This Page