Forwarding serial to terminal and terminal to serial

I just need to send everything I write in the terminal to the serial port and everything that the module responds in the terminal, I tried in several ways but I can’t find the error.

I am using lolin v3 with a sim800l module connected by serial software

this is my sketch

#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
 
SoftwareSerial sim(5, 4);



char auth[] = "xxx";
char ssid[] = "xx";
char pass[] = "xxx";


BLYNK_WRITE(V1)
{
   
    sim.printf(param.asStr());
  
   while(sim.available()) 
  {
    Blynk.virtualWrite(V1, sim.read());
  }
}


void setup()
{

  sim.begin(19200);
  Serial.begin(19200);
 
  Blynk.begin(auth, ssid, pass);
  Blynk.virtualWrite(V1, "clr");
}
 
void loop()
{
   Blynk.run();
}
 


Your connection to your SIM800 needs to be used ONLY for data that is associated with the Blynk communication protocol. This will be a series of AT commands which instruct the SIM800 module what to do to talk to the Blynk server.

What you’re actually trying to do is write other data (the data that comes from your terminal module) to the SoftwareSerial virtual UART, which you call ‘sim’, rather than to the hardware UART called ‘Serial’.

There appear to be other issues with your sketch…

  • I would have expected to see a library such as TinyGSM to handle the comms with the SIM900 module.

  • Reading the serial buffer from within the BLYNK_WRITE callback function probably won’t work.

Pete.

Dear Pete, thank you very much for your response.

I am not looking to connect to blynk through the GSM module. I just need to be able to send AT commands from the Blynk terminal and visualize its response. I am developing something else, but I have difficulties with the signal and I want to take the module outdoors.

With regard to the UART, I initialize the serial monitor, I suppose that if I write in the Serial UART my data would go to that place and not to the module or I am wrong?

(please understand that I am using a translator, I apologize for my grammar mistakes)