Arduino MEGA HM-10 BLE, heartbeat Time out

I am currently building a project for a Engineering controls class that I am gonna end up using to control 3 motors and DHT11 temp sensor by using the blynk app on Android and a BLE HM-10. My problem currently is that my app will not stay connected to the BLE/Ardunio board. I get a message saying connected then heartbeat time out. I have been playing around with the software for a couple days now trying different solutions to try and solve my problem, but nothing has got me passed where I am stuck now. Any help would be much appreciated. All files and android are up to date.


#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <BlynkSimpleSerialBLE.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "?????????????????????";

void setup()
{
  // Blynk will work through Serial
  // 9600 is for HC-06. For HC-05 default speed is 38400
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial1.println("Setting up");
  Blynk.begin(Serial, auth);

  // It never gets here
  Serial.println("Connected");
}

void loop()
{
  Blynk.run();
}

___  __          __

/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.6.1 on Arduino Mega

[90] Connecting…
[9089] Connecting…
[14994] Ready
⸮Connected
⸮[38978] Heartbeat timeout
[38978] Connecting…

Ignore the comments I forgot to delete them after copying some code over.

Your problem is that you are using your serial connection for both debug messages and communication with your HM-10.

You would be better connecting your HM-10 to Serial1 and using Serial for code uploads, debugging etc, as it has a built-in Serial toUSB adaptor which makes it easier to connect to your PC.

Pete.