serial communication with mobile phone

Hi everyone,

I'm using the Sserial2mobile library to communicate between a Motorola c168i and an Arduino Uno. While loading the sketch, I receive the following error:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

What is unusual is that I only receive this error if I plug in the phone to the Tx/Rx pins. The sketch uploads fine if the phone is not connected.

I tried resetting the board and changing usb ports. I've also tried changing the baud rate from 9600 to 4800, but that didn't work. Lastly, I tried reversing the Tx/Rx pin inputs, but it didn't do anything.

Here's the sketch:

#include <ATT.h>
#include <MOT-C168i.h>
#include <SSerial2Mobile.h>
#include <NewSoftSerial.h>

#define RXpin 0
#define TXpin 1 //blue

int returnVal=10;

void setup() {
  Serial.begin(9600);
  SSerial2Mobile phone = SSerial2Mobile(RXpin,TXpin);
 
  Serial.print("Batt: ");
  Serial.print(phone.batt());
  Serial.println("%");
  
  Serial.print("RSSI: ");
  Serial.println(phone.rssi());
  
  phone.sendTxt("+15555555555","Lib SMS Test1");
  delay(3000);
   
}
void loop(){}

Thanks in advance!

If the Tx/Rx pins need to be open while loading the sketch, how does the board communicate with the phone?

Should I connect the phone after uploading the sketch? I didn't do that because the commands are in the setup() function...

I am trying to use the Arduino to send a text message using the phone. My assumption was that once the sketch is loaded onto the board, it immediately runs the code. Therefore, by the time I connect the phone the setup() function will already have run.

If uploading the code has nothing to do with running the code, how is the code initiated? I've run lots of other projects that started working immediately after the code was uploaded.

Thanks!

Great, didn't know that wrinkle. It's still not working, but for other reasons that are not clear yet.

Thanks for the help.