How to connect to BT and print data from Blynk to IDE serial monitor?

I’ve connected Blynk to arduino via Hc05 bluetooth and i want to check virtual pin value (0 or 1) through Serial Monitor. I’ve tried going through docs.blynk.cc steps but still nothing comes out from the Serial Monitor.
Here’s my code:

#define BLYNK_USE_DIRECT_CONNECT

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(0, 1); // RX, TX

//to print from Blynk
#define BLYNK_PRINT DebugSerial
//blueetooth connction library
#include <BlynkSimpleSerialBLE.h>
char auth[] = "57ac041e2a054fdb8d2368735c403f8a";
//Virtual Pin V1
BLYNK_WRITE(V1){
  int U=param.asInt();
  Serial.print("V1 BUTTON value is: ");
  Serial.println(U);
}
//define baud rate here
void setup()
{
  DebugSerial.begin(9600);
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}
//run blynk
void loop()
{
  Blynk.run();

}

please format your code

Blynk - FTFC

First, none of this is Blynk specific… rather basic Arduino learning… You can’t use the same Serial port for multiple connections!

You didn’t mention the hardware you are using… so guessing it might be your UNO.

Your Software Serial designation DebugSerial points to the main UART (Hardware) Serial port… Don’t do that with SoftSerial, use different (supported) pins for Software Serial (and you will also need a TTL-USB adapter and a separate terminal program… I use Termite.).

And both your Blynk.begin and Serial.print() also try to use the same default UART Serial port (AKA pins 0 & 1)… Only one or the other, you can’t use both on the same port. Typically you use the default port for programming and IDE Serial Monitor output, and a software serial port for the BT adapter & Blynk.begin()

1 Like