I have short question regarding this code. This code is
used for sending an e-mail, when a button is pressed.

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT SwSerial
/* Set this to a bigger number, to enable sending longer messages */
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>

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

void emailOnButtonPress()
  // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS! ***

  // Let's send an e-mail when you press the button
  // connected to digital pin 2 on your Arduino

  int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"

  if (isButtonPressed) // You can write any condition to trigger e-mail sending
    SwSerial.println("Button is pressed."); // This can be seen in the Serial Monitor"", "Subject: Button Logger", "You just pushed the button...");

    // Or, if you want to use the email specified in the App (like for App Export):
    //"Subject: Button Logger", "You just pushed the button...");

void setup()
  // Debug console

  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Blynk.begin(Serial, auth);

  // Send e-mail when your hardware gets connected to Blynk Server
  // Just put the recepient's "e-mail address", "Subject" and the "message body""", "Subject", "My Blynk project is online.");

  // Setting the button
  pinMode(2, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);

void loop()

I understand the mehthod of UART, but
why: SoftwareSerial SwSerial(10, 11)?
Why are they used as virtual RX/TX. Is not ist obsolete, because nothing is actually connected to these pins.
What specific task do the pins 10 and 11 have?

Please help me.
I have been searching a lot.

The code is designed to run on an Arduino Uno or similar, that doesn’t have any built-in internet connectivity and has only one hardware serial port.
In this example, the connection to the internet will be via a a USB connection to a PC. The PC will be running a script to allow USB to Internet connection.
The Arduino will connect to the PC with the single hardware serial port. Without a second serial port, it will be impossible to see debug messages, so SoftwareSerial is needed to create a virtual serial port for debugging. To be able to view these debug messages, an FTDI adaptor is needed that will be connected to pins 10 and 11 on the Arduino (with Tx/Rx transposed).



thanks a lot Pete :smiley: