Serial Reference doesn't work for .begin()

thank you!

gfvalvo, may be you know

on NANO board , there are two pins (rx,tx) and usb port
as I know nano has only one serial. so looks like usb and those pins are the same, I mean if we will connect and usb and those pins to some terminals , then on both terminals will be the same printing ?

alexblade:
gfvalvo, may be you know

on NANO board , there are two pins (rx,tx) and usb port
as I know nano has only one serial. so looks like usb and those pins are the same, I mean if we will connect and usb and those pins to some terminals , then on both terminals will be the same printing ?

The Nano only sees serial as USART communication. The FT232 chip on board handles all the USB CDC to UART translation. It enumerates the board as a CDC device with your PC. All the USB part of things is handled in the FT232 chip, and only data is transferred to your sketch.

Yes I know on micro is native USB, on nano just incorporated usb-serial converter. Question was if I on nano send serial.print (aaa) then 'aaa' goes and through USB pins and through rx,tx. On both terminals , connected to USB and rx,tx , I should see 'aaa'?

Yes, because the RX and TX pins are just connected to the chip that handles the USB. Aka, it's just the intermediate connection. See the schematic.

good day friends, regarding last question (about RX/TX on Nano)

Finally I get my nano + external usb-ttl , but couldnt connect it together, may be someone could help me
Here more details NANO + separate USB-SERIAL converter issue - Networking, Protocols, and Devices - Arduino Forum

looking into the file 'HardwareSerial0.cpp'
can't understand

for the NANO board is using first if or second ?

#if defined(UBRRH) && defined(UBRRL)
  HardwareSerial Serial(&UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR);
#else
  HardwareSerial Serial(&UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UCSR0C, &UDR0);
#endif

looks like the first one?

Why don't you write some test code and find out for yourself?

good point. I can. but not now. may be tomorrow. but read/write code now.

btw, gfvalvo, want to ask you

  SoftwareSerial *tempPtr = new SoftwareSerial(10, 11);
  tempPtr->begin(9600);
  gsm = (Stream *)tempPtr;

why you have used temporary pointer ? why not SoftwareSerial gsm = new SoftwareSerial(10, 11);

  1. Because the 'new' operator returns a pointer to the object, not the object itself.
  2. Because gsm needs to be a 'Stream *', not a 'SoftwareSerial' or a 'SoftwareSerial *'

gfvalvo:
2. Because gsm needs to be a 'Stream *', not a 'SoftwareSerial' or a 'SoftwareSerial *'

is this the same/is this also valid?

  Stream *gsm;
  SoftwareSerial _SoftwareSerial(10, 11);
  _SoftwareSerial.begin(9600);
  gsm = &_SoftwareSerial;
  gsm->println("Hello World");

compilation successful