Bluetooth serial bridge
Posted: Sun Sep 29, 2019 1:17 pm
Hi
I am trying to use my Heltec Wifi Kit 32 as a Bluetooth to serial bridge, and it works with the following code:
The issue that I face is that unless the far end has sent some data first, this doesn't work. I am connecting to a standard MAX3232 and then that connects into a standard serial port on a router/firewall/whatever. I can take the jumper wires off the ESP32 and straight on to a Raspberry pi and it works by using screen to go out over /dev/ttyAMA0.
Am I missing something in code to make this work?
Thanks
I am trying to use my Heltec Wifi Kit 32 as a Bluetooth to serial bridge, and it works with the following code:
Code: Select all
#include "BluetoothSerial.h"
#include <HardwareSerial.h>
BluetoothSerial SerialBT;
HardwareSerial MySerial(2);
void setup() {
MySerial.begin(9600, SERIAL_8N1, 16, 17);
SerialBT.begin("wConsole");
delay(4000);
}
void loop() {
if (MySerial.available() > 0) {
SerialBT.write(MySerial.read());
}
if (SerialBT.available() > 0) {
MySerial.write(SerialBT.read());
}
delay(25);
}
Am I missing something in code to make this work?
Thanks