DFRobot TEL0097 Manuel - Page 7
Parcourez en ligne ou téléchargez le pdf Manuel pour {nom_de_la_catégorie} DFRobot TEL0097. DFRobot TEL0097 11 pages. Sim808 gps/gprs/gsm shield
#include <DFRobot_sim808.h>
DFRobot_SIM808 sim808(&Serial);
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() {
//************** Get GPS data *******************
if (sim808.getGPS()) {
Serial.print(sim808.GPSdata.year);
Serial.print("/");
Serial.print(sim808.GPSdata.month);
Serial.print("/");
Serial.print(sim808.GPSdata.day);
Serial.print(" ");
Serial.print(sim808.GPSdata.hour);
Serial.print(":");
Serial.print(sim808.GPSdata.minute);
Serial.print(":");
Serial.print(sim808.GPSdata.second);
Serial.print(":");
Serial.println(sim808.GPSdata.centisecond);
Serial.print("latitude :");
Serial.println(sim808.GPSdata.lat);
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon);
Serial.print("speed_kph :");
Serial.println(sim808.GPSdata.speed_kph);
Serial.print("heading :");
Serial.println(sim808.GPSdata.heading);
Serial.println();
//************* Turn off the GPS power ************
sim808.detachGPS();
}
}
USB Debugging (AT command)
In this section, we will send AT commands through the serial port to debug SIM808 expansion shield. Please refer to SIM808 AT command set for more function.
Preparation
Hardware:
Arduino UNO x1
SIM808 expansion board x1
External power supply x1
Software :
Arduino IDE Click to Download Arduino IDE from Arduino® (https://www.arduino.cc/en/Main/Software)
Serial debugging assistant (In this section, we are using DF Serial Debugger by Lisper
(https://github.com/leffhub/DFRobotSIM808_Leonardo_mainboard/raw/master/Software/DF%20Serial%20Debugger.exe))
'''STEP'''
1. Plug your SIM card on the SIM808 expansion shield and plug the expansion shield on Arduino UNO, meanwhile don't forget to connect an external power
source.
2. Dial the function switch to None, download a sample code Blink to make sure the serial port is not occupied.