and then fix your first post - the code needs to be in code tags; do not ever post images/screen caps of code, they’re often unintelligible, cannot be copied over to the IDE for code inspection/renovation, etc.
My suspicion is, you don’t have
Serial.begin(9600);
in setup anywhere, though I can’t tell from the image as it’s incomplete.
Either that or the actual baud rate doesn't match the baud rate in setup.
Edited– I zoomed in on the picture. It does look like there might be a
Serial.begin (9600)
in setup. If there is a setup. And it looks like the serial monitor matches.
Often but not every time, for the very first read, I get those 4 squares on the first line and then it starts reading correctly. But yours is on the 2nd line. For what it’s worth my serial monitor is set on “New Line”, not “Both NL & CR”. I am not sure what the difference is.
What happens if you close the serial monitor, run the program, and while it is running you open the serial monitor?
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2
void setup() {
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
updateSerial();
mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
updateSerial();
mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
updateSerial();
mySerial.println("AT+CREG?"); //Check whether it has registered in the network
updateSerial();
}
void loop() {
updateSerial();
}
void updateSerial() {
delay(500);
while (Serial.available()) {
mySerial.write(Serial.read()); //Forward what Serial received to Software Serial Port
}
while (mySerial.available()) {
Serial.write(mySerial.read()); //Forward what Software Serial received to Serial Port
}
}
when I close it and open serial monitor while its running , same problem happened
even when write AT commands of Sim800L , the output in serial monitor give me "â–ˇ" character.
Are you sure you have the correct sketch uploaded because I see characters being printed before "Initializing..." but your code does not print before that statement