Go Down

Topic: PROBLEM IN UPLOADING (Read 373 times) previous topic - next topic

Bleyk

/*
  GSM Send Sketch for Arduino
 
  Initializes GSM Module and sends an SMS to recipient
 
  The circuit:
  *Arduino pin 0 (RX) - GSM Module (TX)
  *Arduino pin 1 (TX) - GSM Module (RX)
 
  Created 2010
  by Meann Zabanal
  Modified
  by John for GSM Shield testing
*/

char Rx_data[50];
unsigned char Rx_index = 0;
int i = 0;
char msg[160];
int sig;

void setup() {
  Serial.begin(38400);
 
  initGSM();
  send_msg("09167029131", "Arjen Garcia");
}

void loop() {
  //none
}

void send_msg(char *number, char *msg)
{
  char at_cmgs_cmd[30] = {'\0'};
  char msg1[160] = {'\0'};
  char ctl_z = 0x1a;

  sprintf(msg1, "%s%c", msg, ctl_z);
  sprintf(at_cmgs_cmd, "AT+CMGS=\"%s\"\r\n",number);
 
  sendGSM(at_cmgs_cmd);
  delay(100);
  delay(100);
  delay(100);
  sendGSM(msg1);
  delay(100);
}

void sendGSM(char *string){
  Serial.write(string);
  delay(90);
}

void clearString(char *strArray) {
  int j;
  for (j = 100; j > 0; j--)
    strArray[j] = 0x00;
}

void send_cmd(char *at_cmd, char clr){
  char *stat = '\0';
  while(!stat){
    sendGSM(at_cmd);
    delay(90);
    readSerialString(Rx_data);
   
    stat = strstr(Rx_data, "OK");
  }
  if (clr){
    clearString(Rx_data);
    delay(200);
    stat = '\0';
  }
}

void initGSM(){
 
  send_cmd("AT\r\n",1);                  
//  send_cmd("ATE0\r\n",1); // Turn off automatic echo of the GSM Module   
   
  send_cmd("AT+CMGF=1\r\n",1);         // Set message format to text mode
  //Sucess
 
  Serial.println("Success");
   
  delay(1000);
  delay(1000);
  delay(1000);
}

void readSerialString (char *strArray) {
 
  if(!Serial.available()) {
    return;
  }
 
  while(Serial.available()) {
    strArray = Serial.read();
    i++;
  }
}




PLEASE I NEED HELP !!!!!!!!
AFTER UPLOADING IT ALWAYS SAYS "avrdude: stk500_getsync(): not in sync: resp=0x1c"
HELP ME PLEASE !!!!!!!!!!!!! =( =( =( =( =( =( =( =( =(

Chaul

Can you upload anything to that board? Even just the blink example? Or is just with this wiring and this code? I'm asking because of some of my uploading problems were related to me plugging some IRQ line into the wrong microcontroller pin. Sometimes Windows would just say the device has malfunctioned and it would get disconnected, and other times Arduino IDE would pass along some sync error.

Please don't use all caps.

astrofrostbyte

Like Chaul said , go back to basics, just bare board, simple script.  make sure you have the correct board type selected,  no other devices are competing/locking the serial port.
Gear: Arduino- Uno,Due,Ethernet,  OLS, Buspirate, J-Link, TDS1002, Rigol DG1022

UKHeliBob

Put your code in code tags (#) and STOP SHOUTING !
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PeterH

Apart from the basics which have already been suggested, the Installation and Troubleshooting section might be a more appropriate place for this thread so you might get more help there. Just ask a moderator to move it in that case.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up