aron-bordin / Android-with-Arduino-Bluetooth

Arduino and Android classes to easily connect your mobile device with an Arduino board
GNU General Public License v2.0
73 stars 77 forks source link

Message Not sending and Receiving #3

Open ashishoc opened 9 years ago

ashishoc commented 9 years ago

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();

             }

         });
 }

}