#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX, TX
void setup() {
Serial.begin(9600); // For Serial Monitor
BTSerial.begin(9600); // Default HC-05 baud rate
Serial.println("HC-05 Bluetooth module ready. Type something...");
}
void loop() {
// Read data from HC-05
if (BTSerial.available()) {
char c = BTSerial.read();
Serial.write(c);
}
// Read data from Serial Monitor
if (Serial.available()) {
char c = Serial.read();
BTSerial.write(c);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: