Peguei esse sketch para testar o modulo SIM800L, o código está logo abaixo
Estou usando a porta 10 como RX e 11 como TX do SOFTSERIAL
A Porta RX vai na PORTA TX do Módulo
A Porta TX vai na PORTA RX do Módulo
Para testar a conexão HTTP usei os seguintes comandos
AT
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","zap.vivo.com.br"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://suv.pres-switch.com.br/add.php?teste1=1;texte2=3"
AT+HTTPACTION=0
AT+HTTPTERM
Algo que percebi é que o primeiro comando deve ser o AT, para ele "LIGAR o Módulo"
// This code is a modified version of the code found at:
// http://www.ayomaonline.com/programming/quickstart-sim800-sim800l-with-arduino/
#include <SoftwareSerial.h>
//SIM800 TX is connected to Arduino D8 // PARA O SHIELD
#define SIM800_TX_PIN 10 // ESTOU USANDO O MODULO
//SIM800 RX is connected to Arduino D7 // PARA O SHIELD
#define SIM800_RX_PIN 11 // ESTOU USANDO O MODULO
//Create software serial object to communicate with SIM800
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);
String incString;
void setup() {
//Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
while(!Serial);
//Begin serial communication with Arduino and SIM800
serialSIM800.begin(9600);
delay(1000);
Serial.println("Setup Complete!");
}
void loop() {
//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if(serialSIM800.available()){
Serial.write(serialSIM800.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if(Serial.available()){
// Save serial input to string. If an "AT+CMGS" command has been issued,
// a string of text can be entered for use as the body of the text. To stop
// entering text, Ctrl-Z is typically used. To allow for this in the Arduino Serial
// Monitor, I'm using this pretty hacky method to check the serial input
// for a marker - '/032' to stop entering the text.
// This is a crappy way to do this because I really only want
// to check for the end of message characters after an "AT+CMSG" command is sent.
incString = Serial.readString();
if(incString.equals("/032\r\n"))
{
serialSIM800.write((char)26);
delay(1000);
}
else
{
serialSIM800.write(incString.c_str());
}
}
}