Serial communication

Arduino code:
void setup()
{

Serial.begin(9600);
Serial1.begin(115200);

if(!SD.begin(4))
Serial.println("Errore 0x00000001: SD non inizializzata!");

while(!Serial) {}
Serial.println("Serial apposto");
Serial.println("Serial esp apposto");

}
void loop()
{

if (Serial1.available()){
String command = Serial1.readStringUntil(" END");

Serial.println(command);
commandSwitcher(command);

}

}

Esp code:

void setup(){
Serial.begin(115200);
}
void loop(){
Serial.write("sus");
}

I have cjmcu-3212( GitHub - puckk/CJMCU-3212: How load sketch in ESP8266 in CJMCU-3212 ) but the serial not write anything.

Hi

not enough info (describe setup, wiring, power, ...) and use code tags to post code

a good link for Serial communication: Serial Input Basics
PS: why do you have   while(!Serial) {}after a potential Serial.print for the SD?

Arduino code:
void setup()
{

  Serial.begin(9600);
  Serial1.begin(115200);

On which Arduino? What, EXACTLY, is connected to the Arduino, and where (EXACTLY)?

J-M-L:
Hi

not enough info (describe setup, wiring, power, ...) and use code tags to post code

a good link for Serial communication: Serial Input Basics
PS: why do you have   while(!Serial) {}after a potential Serial.print for the SD?

because i wait serial for debug...Serial is for serial monitor pc. Serial1 is the serian for esp

Gabbro:
because i wait serial for debug...

what are you exactly waiting for?

if Serial is not ready, what do you think then happens if your SD card does not work and you do this

  if(!SD.begin(4))
    Serial.println("Errore 0x00000001: SD non inizializzata!");

J-M-L:
what are you exactly waiting for?

if Serial is not ready, what do you think then happens if your SD card does not work and you do this

  if(!SD.begin(4))

Serial.println("Errore 0x00000001: SD non inizializzata!");

In facts i open serial monitor and print is ready.

so what do you wait for with   while(!Serial) {}:slight_smile:
no big deal and if you are on a MEGA for example this is not needed

answer all the other questions to get this discussion going