I just connected an A6 GSM module and wrote a code to interact with it through the serial monitor connecting at 9600 baud rate. but the character "?" just keeps coming nonstop and nothing else works.
Here is my code:
#include<SoftwareSerial.h>
SoftwareSerial gprs(8, 9);
void setup(){
gprs.begin(9600);
Serial.begin(9600);
}
void loop(){
while (gprs.available())
Serial.write(gprs.read());
while (Serial.available())
gprs.write(Serial.read());
}
I later found you should connect it at 115200 baud rate, and if you want to change the baud rate, command it to do so while you are on default baud rate.
AT+IPR=9600 -- to change it
AT&W -- to save the change
and lowering the baud rate is crucial if using software serial. (the second command should be sent after reconnecting at 9600, since the first command changes the baud rate)