I'm using "mega 2650 pro" Arduino with SIM808 BK-808 V-3.1 and I connect the vcc for the sim808 to 5volt pin in the arduino, and the arduino connected with laptop usb. and I add a sim to the sim808 module.
I upload the following code:
#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
#define PIN_TX 14
#define PIN_RX 15
SoftwareSerial mySerial(PIN_TX,PIN_RX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
//******** Initialize sim808 module *************
while(!sim808.init()) {
delay(1000);
Serial.print("Sim808 init error\r\n");
}
//************* Turn on the GPS power************
if( sim808.attachGPS())
Serial.println("Open the GPS power success");
else
Serial.println("Open the GPS power failure");
}
void loop() {
//************** Send the coordinates(latitude&lonitude)in the Serial Monitor *******************
if (sim808.getGPS()) {
Serial.print("latitude :");
Serial.println(sim808.GPSdata.lat);
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon);
}
}
but the output is
Sim808 init error
and I tried several codes to test AT commands, nothing work!
so what is the problem?
Sim808 init error
print only once?