how to connect arduino to android via bluetooth
you need-
arduino uno or other arduino board
HC-05/HC-06 bluetooth module
jumper wire
9v power or battery
Download mobile app ardudroid or any other app from paly store
send serial data 1 --glow led
send serial data 0 -- put off led
blutooth module HC-05 password 1234
connection
vcc to 5v
GND to GND
RX to TX
TX to RX
arduino code--
char data = 0; //Variable for storing received data
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data and store it into variable data
Serial.print(data); //Print Value inside data in Serial monitor
Serial.print("\n"); //New line
if(data == '1') //Checks whether value of data is equal to 1
digitalWrite(13, HIGH); //If value is 1 then LED turns ON
else if(data == '0') //Checks whether value of data is equal to 0
digitalWrite(13, LOW); //If value is 0 then LED turns OFF
}
}
upload this code to arduino
arduino uno or other arduino board
HC-05/HC-06 bluetooth module
jumper wire
9v power or battery
Download mobile app ardudroid or any other app from paly store
send serial data 1 --glow led
send serial data 0 -- put off led
blutooth module HC-05 password 1234
connection
vcc to 5v
GND to GND
RX to TX
TX to RX
arduino code--
char data = 0; //Variable for storing received data
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data and store it into variable data
Serial.print(data); //Print Value inside data in Serial monitor
Serial.print("\n"); //New line
if(data == '1') //Checks whether value of data is equal to 1
digitalWrite(13, HIGH); //If value is 1 then LED turns ON
else if(data == '0') //Checks whether value of data is equal to 0
digitalWrite(13, LOW); //If value is 0 then LED turns OFF
}
}
upload this code to arduino
Need help please help me..in Arduino mobile connection with HC05 and 8channel relay
ReplyDelete