Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to read and set RTC in SIM900 GSM Shield

Status
Not open for further replies.

thandana

Junior Member level 1
Joined
Nov 27, 2014
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
367
Hi,

I found this sketch in the internet on how to read/set the time in the SIM900 GSM shield:
I have an issue that everytime the time is read, it doesn't show the whole time, it sometimes leaves some digits out. Please see attached output.

Any help will be highly appreciated.

Code:

Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
int i=0;
void setup()  
{
// Open serial communications and wait for port to open:
  Serial.begin(19200);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(19200);
 // mySerial.println( "AT+CCLK =\"14/11/12,10:43:50+08\"");
}
void loop() // run over and over
{
   delay(50);
  if (mySerial.available())
    Serial.write(mySerial.read());
   delay(50);
mySerial.println( "AT+CCLK?" );
    delay(50);
    if (mySerial.available())
    Serial.write(mySerial.read());
   delay(50);
   i++;
   if (i==50)
   {
   mySerial.flush();
   i=0;
   }
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top