From f5f1acb430531b9c73537f87864ea37b5e6ffc77 Mon Sep 17 00:00:00 2001 From: ozarchie <6479143+ozarchie@users.noreply.github.com> Date: Sun, 17 Feb 2019 12:32:17 +1000 Subject: [PATCH] Initial load --- Software/EQMODBluetooth/EQMODBluetooth.ino | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Software/EQMODBluetooth/EQMODBluetooth.ino diff --git a/Software/EQMODBluetooth/EQMODBluetooth.ino b/Software/EQMODBluetooth/EQMODBluetooth.ino new file mode 100644 index 0000000..d15015c --- /dev/null +++ b/Software/EQMODBluetooth/EQMODBluetooth.ino @@ -0,0 +1,37 @@ +//This example code is in the Public Domain (or CC0 licensed, at your option.) +//By Evandro Copercini - 2018 +// Modified John Archbold - February2019 +//This code creates a bridge between Serial2 and Classical Bluetooth (SPP) +// It has been modified for the EQMOD serial device based on the ESP32 +// Debug data is sent to the USB port +// Serial data is sent to/from the Serial2 prot from the BT port +// The EQG is connected directly to the Serial2 port + +#include "BluetoothSerial.h" + +#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) +#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it +#endif + +BluetoothSerial SerialBT; + +#define dbgSerial Serial +#define EQGSerial Serial2 +#define EQGBluetooth SerialBT + +void setup() { + Serial.begin(115200); + EQGSerial.begin(9600, SERIAL_8N1, 18, 19); // EQG via serial, bluetooth or WiFi + EQGBluetooth.begin("EQGBlue"); //Bluetooth device name + Serial.println("The device started, now you can pair it with bluetooth!"); +} + +void loop() { + if (EQGSerial.available()) { + EQGBluetooth.write(Serial.read()); + } + if (EQGBluetooth.available()) { + EQGSerial.write(SerialBT.read()); + } + delay(5); +}