Answer the question
In order to leave comments, you need to log in
How to make ESP8266 and HC-05 work together?
Sketch with comments-explanations:
#include <SoftwareSerial.h>
#define LED 2
SoftwareSerial BTSerial(9, 10); //RX, TX
void setup()
{
delay(500);
BTSerial.begin(9600); //С 38400 тоже пробовал
Serial.begin(9600);
delay(500);
}
void loop()
{
char data_received = BTSerial.read();
if (data_received == '1')
{
digitalWrite(LED, LOW);
Serial.println("LED turned ON");
}
else if (data_received == '2')
{
digitalWrite(LED, HIGH);
Serial.println("LED turned OFF");
}
}
HC-05 | ESP8266 | |
---|---|---|
STATE | ||
RXD- | -TX (GPIO 1) | |
TXD- | -RX (GPIO 3) | |
GND- | -GND | |
VCC (5V)- | -CN6009- | 3V3 (3.3V) |
EN- | 3V3 (Without this, the phone does not connect to the module) |
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question