After some further testing I (found there were 4 serials on Mega). Bluetooth is on Serial3
So to communicate with the MegaPi Bluetooth module, pairing is done automatically by the module, you only need to setup the serial communication.
Here is a simple sketch to test this.
#include <MeMegaPi.h>
void setup() {
Serial.begin(115200);
Serial3.begin(115200);
}
void loop() {
// Write back data received from Bluetooth to Serial monitor
if (Serial3.available()) {
Serial.write(Serial3.read());
}
// Send to Bluetooth data received from Serial monitor
if (Serial.available()) {
Serial3.write(Serial.read());
}
}