hello,
i have some problems to comunicate arduino with gsm tc35 module...
i use max232 and a serial cable like show the example in:
When i try to comunicate to hyperterminal or another terminal software, the commands are ok!!!!
arduino -> terminal = OK
terminal -> arduino = OK
terminal -> modem = OK
modem -> terminal = OK
arduino -> modem = NOT WORKS (it does not happen anything)
i try with the simple AT command "AT"
the correct string is:
"at\r\n" or in decimal: 65,84,13,10
if i type this into the terminal and send to modem,
the modem respond with a "ok" message
but if
i send this with arduino, the modem not respond...!!!!
what do you think about this????
this is my code to test the connection!!!
char serInString[100];
int led1 = 2;
int led2 = 13;
void readSerialString (char *strArray) {
int i = 0;
if(Serial.available()) {
//Serial.print("reading Serial String: "); //optional: for confirmation
while (serialAvailable()){
strArray[i] = Serial.read();
//if( (strArray[i] == 'K') && (strArray[i-1] == 'O') )
digitalWrite(led1, HIGH);
i++;
//Serial.print(strArray[(i-1)]); //optional: for confirmation
}
if (strArray[i] != 0) {
while(strArray[i] != 0) {
//Serial.print( strArray[i] );
strArray[i] = 0; // optional: flush the content
i++;
}
}
//Serial.println(); //optional: for confirmation
}
}
void printSerialString(char *strArray) {
int i=0;
if (strArray[i] != 0) {
while(strArray[i] != 0) {
Serial.print( strArray[i] );
strArray[i] = 0; // optional: flush the content
i++;
}
}
}
void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT); // declare LED as output
pinMode(led2, OUTPUT); // declare LED as output
}
void loop () {
readSerialString(serInString);
digitalWrite(led2, HIGH);
Serial.print(65, BYTE); // 'A' // first way
Serial.print(84, BYTE); // 'T'
Serial.print(13, BYTE);
Serial.print(10, BYTE);
delay(1000);
Serial.print("at\r\n"); // second way
delay(1000);
digitalWrite(led2, LOW);
digitalWrite(led1, LOW);
delay(1000);
}
and this is my schematic of the shield!!!
thanks,
Alex