I am using Arduino Uno and GSM sim800l for a project and looks like something is wrong and I don't know what it is. Here is my code:
#include <AltSoftSerial.h>
AltSoftSerial altSerial;
void setup() {
Serial.begin(19200);
Serial.println("AltSoftSerial Test Begin");
altSerial.begin(19200);
altSerial.println("Hello World");
}
void loop() {
char c;
altSerial.print("altSerial is working.");
if (Serial.available()) {
c = Serial.read();
altSerial.print(c);
}
if (altSerial.available()) {
c = altSerial.read();
Serial.print(c);
}
}
Its output was like this:
AltSoftSerial Test Begin (linebreak)
Hello World (linebreak)
ltSerial is ok⸮⸮M⸮ɥ⸮⸮⸮is okalt //insert long random garbage here
I tried changing the baud rate of the code and serial monitor to keep it matched but it is not working, I tried to lower it as low as 300 and tried up to 19200 as well.
Any ideas would help. I also tried Tools-> Fix encoding and reload but it still didn't solve the problem. It is my first time using this type of hardware so please bear with me. My goal is to use it to send SMS messages but right now I'm trying a smaller task with it to try and understand it better.
Btw, the Arduino IDE I am using is 1.8.7