Android-with-Arduino-Bluetooth icon indicating copy to clipboard operation
Android-with-Arduino-Bluetooth copied to clipboard

Message Not sending and Receiving

Open ashishoc opened this issue 10 years ago • 0 comments

Hi, Your android code not working even not sending messages or receiving. What I did here??? I upload your arduino code in my arduino nano board. Then develop arduino app for simply connect and send message using your code. But no luck. How I know??? I try S2 terminal App It's working. Your arduino code well responding with S2 terminal. Problem: Device is connecting well with arduino but not sending & Receiving msg even not throwing any exception. Here is my activity...

    public class MainActivity extends Activity {
BluetoothArduino mBlue ;
 @Override 
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mBlue = BluetoothArduino.getInstance(this,"Arduino");
    mBlue.Connect();
    Toast.makeText(this,mBlue.getLastMessage(),Toast.LENGTH_SHORT).show();
     Button b=(Button)findViewById(R.id.buttonOn);
     Button c=(Button)findViewById(R.id.buttonSearch);
     b.setOnClickListener(new OnClickListener(){

             @Override
             public void onClick(View p1)
             {

                 mBlue.SendMessage("Hi from Android!");
             }


     });
     c.setOnClickListener(new OnClickListener(){

             @Override
             public void onClick(View p1)
             {
                 Toast.makeText(getApplicationContext(),mBlue.getLastMessage(),Toast.LENGTH_SHORT).show();

             }


         });
 }



}

ashishoc avatar Aug 02 '15 12:08 ashishoc