0% found this document useful (0 votes)
46 views

Create Android App To Control Arduino Car With Bluetooth

The document provides steps to create an Android app to control an Arduino car with Bluetooth. It includes code snippets for setting up Bluetooth communication in the Arduino sketch and Android app to send and receive messages between the two devices.

Uploaded by

aloy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
46 views

Create Android App To Control Arduino Car With Bluetooth

The document provides steps to create an Android app to control an Arduino car with Bluetooth. It includes code snippets for setting up Bluetooth communication in the Arduino sketch and Android app to send and receive messages between the two devices.

Uploaded by

aloy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 1

create android app to control arduino car

with bluetooth
I'll just paste the Steps here, in case the link expires someday.

1. At the top of your source code, include these libs.


2. #include "SoftwareSerial.h"
#include "Bluetooth.h"
3. To start using it, at the top of your source declare a public variable to access it:

Bluetooth *blue = new Bluetooth(2, 3);


With Bluetooth(RX_Pin, TX_Pin)

The default pin is 1234, name is “PNGFramework” and baudrate is 9600


4. Now, on your Setup(), add the follow line:
5. void setup(){
6. Serial.begin(9600);
7. blue->setupBluetooth();
}
8. Send a message when we receive some data from Serial.
9. void loop(){
10. String msg = blue->Read();
11. if(msg.length() > 1){
12. Serial.print("Received: ");
13. Serial.println(msg);
14. }
15. if(Serial.available()){
16. blue->Send("Example message#");
17. }
}
In Android
1. First, create a bluetooth object, use the following code, make sure to use the same
RobotName that you used in the Arduino project. (default is “PNGFramework”).
BluetoothArduino mBlue = BluetoothArduino.getInstance("PNGFramework");
2. To connect with the Arduino, add the command bellow:
mBlue.Connect();
3. Now, to read a message, run the command:
String msg = mBlue.getLastMessage();

You might also like