Issue Connecting HC-06 with Arduino Mega

I am trying to control a robot remotely via an HC-06 Bluetooth Module and an Arduino Mega 2560. I have tested all of the code via USB and it worked just fine. When I connected via the HC-06, however, the app is not communicating properly. I changed the communication to bluetooth in the app and connected to the module via the bluetooth widget. The app even says that the module is online but my sensor read-outs are not updating on my app panel. Does anyone have any suggestions?

Code is below (note that some of the functions called are not shown as they are in another tab):

/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial1

  #include <Servo.h>
  #include "IRTemp.h"
  #include <BlynkSimpleSerialBLE.h>
  #include <SoftwareSerial.h>

  //char auth[] = "e18af7a4357043819a84cf9c074e226a"; //Wynelle's Phone
  char auth[] = "af30119367fd4b9ea111f78318fd9b14"; //Isabelle's Phone

//UR Pins and Vars
  #define trigPin 10
  #define echoPin 13
  long duration, distance; // Duration used to calculate distance

//IR Pins and Vars
  static const byte PIN_DATA    = 2; // Choose any pins you like for these
  static const byte PIN_CLOCK   = 3;
  static const byte PIN_ACQUIRE = 4;
  static const TempUnit SCALE=FAHRENHEIT;  // Options are CELSIUS, FAHRENHEIT
  float irTemperature, ambientTemperature;

//Alarm Pins and Vars
  #define Buzz_PIN 6

  int t1;

//Motor Pins and Vars
  #define LeftMotorSpeed 5  // Enable Pin for motor 1
  #define RightMotorSpeed 7 // Enable Pin for motor 2

  //H,L = Forward; L,H = Backward; H,H = Stop
  #define I1 8  // Control pin 1 for motor 1
  #define I2 11  // Control pin 2 for motor 1
  #define I3 12  // Control pin 1 for motor 2
  #define I4 22  // Control pin 2 for motor 2
  int x=0;
  int y=0;
  int minRange = 312;
  int maxRange = 712;
  int minSpeed = 450;
  int maxSpeed = 1023;
  int noSpeed = 0;

//Servo Variables
  int servpos =0;
  int servpos_new;
  Servo servo;

//Timer Variables
  BlynkTimer timer;

//Servo write
  servpos_new = param.asInt();

//Joystick write
  int x1 = param[0].asInt();
  int y1 = param[1].asInt();

// Enable/disable blinking using virtual pin 4
  if (param.asInt()) {
  } else {
    digitalWrite(Buzz_PIN, LOW);

// Change blink interval using virtual pin 5
  long interval = param.asLong();
  boolean wasEnabled = timer.isEnabled(t1);
  t1 = timer.setInterval(interval, alarmBlynk);
  if (!wasEnabled) {

void Ultrasonic_Read(){
  Blynk.virtualWrite(8,distance);// virtualpin 8 distance

void IR_Read(){
  Blynk.virtualWrite(1,irTemperature);// virtualpin 1 ir temperature

void Ambient_Read(){
  Blynk.virtualWrite(2,ambientTemperature);// virtualpin 2 ambient temperature

void setup(){
  // Debug console
  SoftwareSerial SerialBLE(29,31); // RX, TX
  Blynk.begin(SerialBLE, auth);

    Serial.println("Waiting for connections...");
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(LeftMotorSpeed, OUTPUT);
  pinMode(RightMotorSpeed, OUTPUT);
  pinMode(I1, OUTPUT);
  pinMode(I2, OUTPUT);
  pinMode(I3, OUTPUT);
  pinMode(I4, OUTPUT);
  pinMode(Buzz_PIN, OUTPUT);
  timer.setInterval(1000L, measureDistance);
  timer.setInterval(2005L, IR_temp);
  timer.setInterval(1000L, Ultrasonic_Read);
  timer.setInterval(2010L, IR_Read);
  //timer.setInterval(2005L, Ambient_Read);
  timer.setInterval(50L, Motor_Control);
  //timer.setInterval(500L, Servo_Control);
  t1 = timer.setInterval(500L, alarmBlynk);

void loop()
{;; // Initiates SimpleTimer

Welcome to the Forum.

First off, please read through the Welcome Topic as that explains how to properly format any posted code here for proper viewing.

As for you issue… Please understand that Blynk uses BT/BLE as a dedicated background link between the MCU and the App… that link is NOT available for you to use directly, as is sometimes normal in other BT/BLE type applications.

And depending on the type of phone you use… Android seems to have better results with BT/BLE then iOS.

BT/BLE also still seems a bit in the Beta stage and can have some significant, quirks and limitations. If at all possible, even using an ESP as shield option is a prefered MCU <–> Server link.

We highly recommend you start off with much simpler projects until you get a better understanding of both the various commands, and App <–> Server <–> MCU communications work.

I also recommend you spend some reading time over on the Arduino site, particularly how to use the Mega’s multiple Hardware Serial ports instead of the much more limited SoftwareSerial.

Another thing that I can’t confirm if relevant or not in your case, without seeing the rest of your code, is that BT/BLE, being a “serverless” link between the App and MCU, will NOT work with certain Blynk functions like Blynk.syncVirtual(vPin) as they require an MCU <–> Server link… which you did have with the USB link, but do not have with BT/BLE