AT COMMANDS bugg

hello everyone, :slight_smile:
please i need help in my Arduino. I am using an ICOMSAT V.1.1 SIM900 shield to interface an arduino, and i am trying to cmmunicate using AT commands. However, for nearly all AT commands i send, either the shield goes off, or i have in return “AT%13%”. please could someone help?

As a matter of fact, i am trying to acquire and use GSM time in a project, without success for quite a time now, but no method i tried was an isssue (this is one of them) please help. :frowning: :sob:

sketch_sep07b.ino (1.15 KB)

#include <GSM.h>
GSM gsmAccess(true);

char answer[100];

void setup()
{
 Serial.begin(9600);
 
 boolean notConnected = true;
 
 Serial.println("Connecting to the GSM network");
 
  while(notConnected) 
  {
    int ok = 0;
    gsmAccess.ready(); //Call this if debugging is on. Otherwise we will never reach GSM_READY...?!?
    delay(1000); //might not call ready too often.??? See GSM3ShieldV1AccessProvider.cpp, GSM3ShieldV1AccessProvider::begin
    ok = gsmAccess.getStatus();
    if (ok != GSM_READY){
      Serial.print(F("GSM status: "));
      Serial.println(ok);
    } else {
      notConnected = false;
    }
  }

}

void loop()
{
     
     Serial.println("Connected. Sending AT Command.");
     theGSM3ShieldV1ModemCore.println("AT");
     delay(1000);
     Serial.println("\n");
     theGSM3ShieldV1ModemCore.println("AT+COPS=2");
     delay(100);
     theGSM3ShieldV1ModemCore.println("AT+CTZU=1");
     delay(100);
     theGSM3ShieldV1ModemCore.println("AT+COPS=0"); 
     delay(100);
     theGSM3ShieldV1ModemCore.println("AT+QNITZ=1"); 
     delay(100);
      theGSM3ShieldV1ModemCore.println("AT+CCLK?"); 
     delay(5000);
     Serial.println("\n\n");
}
     theGSM3ShieldV1ModemCore.println("AT");
     delay(1000);
     Serial.println("\n");
     theGSM3ShieldV1ModemCore.println("AT+COPS=2");

Send an AT command. Twiddle your thumbs for a while. Assume the first coomand worked, without bothering to check, and send another one.

Please explain WHY you assume that every AT command will be processed correctly in your world.

hello, thanks to all for replying.

AWOL, i tried the code you've posted, but the compiler doesn't ever gets out of the while loop, this is what it gives :

Connecting to the GSM network
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
GSM status: 0
....etc

but the Shied is on, it blinks once every 3 secs as its supposed to do.
it doesnt ever gets into the void loop { }

Have you set the Rx/Tx jumpers to match the pins used by the Arduino to communicate with the shield?

yes dannable, i have set them to pins 7 and 8. I read a previous post where you were talking about this.

And which library are you using? The one with the IDE? Intended for use with the Quectel M10 (official shield), not the SIM900? If so it doesn't use pins D7 & D8.

AWOL, i tried the code you've posted

It was your code.

i tried both GSM.h and SIM900.h , both do not give results, as soon as i send the command, either the shield restarts, or returns -1 or AT%13%

however Dannable, could you please further explain which you say do not use pins D7 and D8?

AWOL:
It was your code.

yeah, but i tried the one with the editing you've done, that's from where i say i still got thesame problem... :frowning:

No, I said the the library included with the IDE doesn't use D7 & D8.

I'm not familiar with SIM900.h - does it require a separate declaration of SoftwareSerial or does it include it? If the latter then you need to examine the code to see which pins it is using.

Dannable, wait i guess i got you now. are you saying the library included in the IDE uses instead the pins D1 and D3??

Because on the last post, it was about sending sms, and the sim900 library was used with the pins D7 and D8.

excuse i made an error. it means GSM.h uses instead pins D2 and D3?

It does indeed. And pin D7 for software power control.

okay it means if i wish to use tis library with pins D7 and D8 i should instance software serial and precise which pins i'm using?

The one with the IDE? You need to edit the pin declarations in the library to use whatever you have selected. And the Modem reset which is D7 by default.

This is why I don't use libraries.

Cyphrix_17:
yeah, but i tried the one with the editing you've done, that's from where i say i still got thesame problem... :frowning:

I didn't touch your code, I simply posted it in code tags, as you should have done in the first place

hello world!!! :slight_smile:

after searching and facing alot of buggs using AT COMMANDS :confused: , i changed back to ARduino libraries.

so i have this new code, which is having one more trouble ( :frowning: :confused: ), which i hope shall be easier to solve with your help.

#include <DateTimeStrings.h>
#include <DateTime.h>


void setup(){
 DateTime.sync(DateTime.makeTime(0, 15, 11, 10, 9, 2015));
 Serial.begin(9600);
}

void  loop(){    
 if(DateTime.available()) {
   unsigned long prevtime = DateTime.now();
   while( prevtime == DateTime.now() )  // wait for the second to rollover
     ;
   DateTime.available(); //refresh the Date and time properties
   digitalClockDisplay( );   // update digital clock  
 }
}

void printDigits(byte digits){
 // utility function for digital clock display: prints preceding colon and leading 0
 Serial.print(":");
 if(digits < 10)
   Serial.print('0');
 Serial.print(digits,DEC);
}

void digitalClockDisplay(){
 // digital clock display of current time
 Serial.print(DateTime.Hour,DEC);  
 printDigits(DateTime.Minute);
 Serial.print(DateTimeStrings.dayStr(DateTime.DayofWeek));
 Serial.print(" ");
 Serial.print(DateTimeStrings.monthStr(DateTime.Month));
 Serial.print(" ");
 Serial.print(DateTime.Day,DEC);
}

but now i have this error i dont understant :

Arduino : 1.6.3 (Windows 8), Carte : “Arduino Uno”

In file included from sketch_sep10b.ino:8:0:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:117:14: error: conflicting declaration ‘typedef bool boolean’

typedef bool boolean;

^

In file included from C:\Users\Emmanuel\Documents\Arduino\libraries\DateTimeStrings/DateTimeStrings.h:14:0,

from sketch_sep10b.ino:3:

C:\Users\Emmanuel\Documents\Arduino\libraries\DateTime/DateTime.h:17:17: error: ‘boolean’ has a previous declaration as ‘typedef uint8_t boolean’

typedef uint8_t boolean;

^

Multiple libraries were found for “DateTimeStrings.h”

Used: C:\Users\Emmanuel\Documents\Arduino\libraries\DateTimeStrings

Not used: C:\Users\Emmanuel\Documents\Arduino\libraries\DateTime

Not used: C:\Program Files (x86)\Arduino\libraries\DateTime

Multiple libraries were found for “DateTime.h”

Used: C:\Users\Emmanuel\Documents\Arduino\libraries\DateTime

Not used: C:\Program Files (x86)\Arduino\libraries\DateTime

Erreur lors de la compilation.

Ce rapport contiendrait plus d’informations si l’option
“Montrer les informations de sortie pendant la compilation”
était activée dans Fichier > Préférences.

please World, could someone help…anyone would be very helpful and appreciated. thanks :slight_smile: