2

Sim800L's library can not compile on Arduino Due. Is there any way to create a library for Arduino Due?

#include <Sim800l.h>
#include <SoftwareSerial.h>

Sim800l Sim800l;
char* text;
char* number;
bool error;

void setup(){
    Sim800l.begin(); 
    text = "Testing Sms";
    number = "2926451386";
    error = Sim800l.sendSms(number,text);
    // OR
    //Sim800l.sendSms("+540111111111","the text go here")
}

void loop(){
    //do nothing
}

I guess that the problem is the software serial library, too. However, I don't know how to replace this library for Arduino Due.

Any help appreciated.

3
  • 1
    Without the error it is not possible to tell you what is happening. It like walking to a mechanic and saying your car doesn't work. Without the car or a description of the problem he isn't going to have a scoobies. SO Whats the exact error message you see. Commented Oct 31, 2016 at 12:59
  • You should probably rework thinks to use one of the Due's other hardware UARTs. If you find a generic demo for using the port (or look at the Due docs) that should be simple, and if you get the Sim800l library in question in editable form and take time to understand it you should be able to make the changes. But you are going to need to do the work yourself, or else spend some time doing your own web searches to see if someone already has. Commented Oct 31, 2016 at 17:50
  • Error massage: Error compiling for board Arduino Due (Programming port)
    – Ibn Sina
    Commented Nov 1, 2016 at 5:14

1 Answer 1

1

First we must delete the SoftwareSerial and SIM800L libraries, then define Sim800l and assign it to Serial 3 on pins 14 and 15. In setup, call Sim800l.begin() and the rest of the code is unchanged.

#define SIM800l Serial3

void setup () {
  Serial.begin (9600);
  SIM800l.begin (9600);
  while(!Serial);
  SIM800l.write ("AT+CMGF=1\r\n");
  delay (1000);
  SIM800l.write("AT+CMGS=\"5432154552"\"\r\n");
  delay(1000);
  Serial.println("send SMS");
  SIM800l.write ("test send SMS");
  delay (1000);
  SIM800l.write ((char)26);
  delay(1000);
}

void loop (){}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.