hi guys im doing a project that recives sms's
I've bought GSM Sheild SM5100B-D
and wrote the following code, in oreder of reading SMS recived by the sim card
#include <GSM.h>
#define PINNUMBER ""
GSM gsmAccess;
GSM_SMS sms;
char sendingNumber [20]; //storing the number of the sender's sms
void setup(){
Serial.begin(9600);
Serial.println("sms reciving mode");
boolean isConnected = false;
while(isConnected){
if(gsmAccess.begin(PINNUMBER)==GSM_READY){
isConnected = true;
}else{
Serial.println("not connected");
delay(1000);
}
Serial.println("GSM initialized.");
Serial.println("Waiting for messages");
}
}
void loop(){
char tempSms;
if(sms.available()){
Serial.println("Message received from:");
sms.remoteNumber(sendingNumber, 20); //gets the sender's number
Serial.println(sendingNumber);
while(tempSms=sms.read()){ // this loop reads the sms
Serial.print(tempSms); // and print it char by char
}
Serial.println("\nEND OF MESSAGE");
}
delay(1000);
}
separately the SIM works fine
i get the following error:
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x7e
avrdude: stk500_cmd(): programmer is out of sync
please help me out, what am i doing wrong