Hi, I'm attempting to use an Arduino to control a mobile phone send an SMS. The principle seems to be quite simple, 1) send a command to set the phone to SMS mode, 2) set the phone number, 3) send the message. I've managed to write a similar bit of code using C# .Net so I'm reasonably sure that I've got the correct commands and the phone is working. The problem is getting the same commands to work on the arduino.
When I leave the arduino plugged into my PC and monitor it's output the characters it sends seem to be correct, but when I remove the PC and connect it to the phone itself nothing happens.
I have two questions
- Any ideas why it's not working?
- How can I monitor the communications between the arduino and phone? It seems I can use a split USB lead to connect the arduino to both the phone and PC at the same time, but the serial monitor will only pick up the data from the arduino, not any data coming back from the phone to the arduino.
A code snipet follows........
//first go.....
Serial.flush();
delay(1000);
Serial.println("");
Serial.print("AT+CMGF=1"); //set to SMS mode
Serial.print(13,BYTE);
Serial.print(10,BYTE);
delay(1000);
Serial.print("AT+CMGS="123456789""); //set the phone number (wrapped in double quotes)
Serial.print(13,BYTE); //Carriage return and line feed
Serial.print(10,BYTE);
delay(1000);
Serial.print("hello world");
Serial.print(26,BYTE); //'ctrl+z' or 'SUB'
delay(500);
Serial.print(13,BYTE); //Carriage return and line feed
Serial.print(10,BYTE);
//Second attempt.......
Serial.flush();
delay(1000);
Serial.println("AT+CMGF=1"); //set to SMS mode
delay(1000);
Serial.println("AT+CMGS="123456789""); //set the phone number
delay(1000);
Serial.print("hello world2");
Serial.print(26,BYTE); //'ctrl+z' or 'SUB'
Serial.println("");