0% found this document useful (0 votes)
28 views2 pages

Send SMS

The document describes code for reading SMS messages from a SIM808 module connected to an Arduino. It initializes the SIM808 module, checks for unread messages, reads the message if unread messages exist, and deletes the message after reading.

Uploaded by

James Okafor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Send SMS

The document describes code for reading SMS messages from a SIM808 module connected to an Arduino. It initializes the SIM808 module, checks for unread messages, reads the message if unread messages exist, and deletes the message after reading.

Uploaded by

James Okafor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <DFRobot_sim808.

h>

#define MESSAGE_LENGTH 160

char message[MESSAGE_LENGTH];

int messageIndex = 0;

char phone[16];

char datetime[24];

DFRobot_SIM808 sim808(&Serial);

void setup() {

//mySerial.begin(9600);

Serial.begin(9600);

//******** Initialize sim808 module *************

while(!sim808.init()) {

Serial.print("Sim808 init error\r\n");

delay(1000);

delay(3000);

Serial.println("Init Success, please send SMS message to me!");

void loop() {
//*********** Detecting unread SMS ************************

messageIndex = sim808.isSMSunread();

Serial.print("messageIndex: ");

Serial.println(messageIndex);

//*********** At least, there is one UNREAD SMS ***********

if (messageIndex > 0) {

sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);

//***********In order not to full SIM Memory, is better to delete it**********

sim808.deleteSMS(messageIndex);

Serial.print("From number: ");

Serial.println(phone);

Serial.print("Datetime: ");

Serial.println(datetime);

Serial.print("Recieved Message: ");

Serial.println(message);

You might also like