#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1);
int ledpin=13;
int Data;
void setup()
{
mySerial.begin(9600);
pinMode(ledpin,OUTPUT);
}
void loop()
{
if (mySerial.available())
{
Data=mySerial.read();
if(Data=='1')
{
digitalWrite(ledpin,HIGH);
mySerial.println("LED On! ");
}
else if (Data=='0')
{
digitalWrite(ledpin,LOW);
mySerial.println("LED Off! ");
}
}
}
I manage to pair ANDROID and HC-05 module
When I enter through the BT Terminal command "1" to turn on the LED ON nothing happens.
When the Arduino IDE to Serial montor I type "1" lights up LED on the Android BT terminal writes "LED On!".
When I give the command "0" LED off and ANDROID BT terminal prints "LED Off!"
There is no communication between Android and Arduino UNO
I would ask for the help, since I am a beginner and I can not solve the resulting problem.
I am a beginner in the Arduino programming.
I made an app for Android that will over bluetooth to turn on and off two LEDs.
Below ANDROID app and Arduino code.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
int LED = 8;
int LED1 = 13;
char character;
void setup()
{
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
pinMode(LED, OUTPUT);
pinMode(LED1, OUTPUT);
}
void loop() // run over and over
{
String Data = "";
while(mySerial.available()) {
character = mySerial.read();
Data.concat(character);
delay (10);
}
if (Data == "1") digitalWrite(LED, HIGH);
if (Data == "0") digitalWrite(LED, LOW);
if (Data == "3") digitalWrite(LED1, HIGH);
if (Data == "2") digitalWrite(LED1, LOW);
}
Now I'm interested in how to connect the HC-05 in the picture and change the part of the code
SoftwareSerial mySerial(10, 11); // RX, TX
When you connect as shown run Android APP i manage to pair the BT module. But there is no communication application does not work
I dont knov have to conect hc-05 to arduino. I faind picture and cood on internet and conect like pictur and not work. I ask have to conect hc-05 to arduino uno .
Arduino-beginner:
I dont knov have to conect hc-05 to arduino.
Evidently. You might try reading reply#3 again. The notes in the link also have some pretty pictures of wiring - including a voltage divider on Arduino Tx, which isn't a bad idea..