Hello, I have a SM5100b that I have successfully connected to a host manually via the Arduino Serial window and passthrough sketch.
I'm brand new to Arduino coding, but I do have limited coding experience in Matlab primarily. I'd like to write a function that connects the module and reads each of the responses that the Module outputs. Here is what I have, but it's not working:
#include <string.h> //Used for string manipulations
char incoming_char=0; //Will hold the incoming character from the Serial Port.
void setup()
{
//Initialize serial ports for communication.
Serial.begin(9600); // for terminal communication
Serial1.begin(115200); // for GSM module communication
Serial.println("Starting SM5100B Communication...");
}
void loop() {
//If a character comes in from the cellular module...
if(Serial1.available() >0)
{
incoming_char=Serial1.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
Serial1.print("AT+SATT=1,0");
Serial1.print("AT+CGATT?");
}
Pretty basic I know but it doesn't return any of the loading data (+SIND: 11 etc) nor the module response after it sends the AT commands. Any help is greatly appreciated.