Connect ArduinoUno + Sim808 + Firebase

0

Good Colleagues days ago I am trying to connect my Arduino Uno to Firebase through the Sim Module 808, I have the following code, but I can not insert data to Firebase, specifically I have not achieved the connection. If anyone had a clearer example, it would be helpful.

#include <SoftwareSerial.h>)

SoftwareSerial gprsSerial(7, 8);

void setup()

{

gprsSerial.begin(19200);

Serial.begin(19200);


Serial.println("Config SIM900...");

delay(2000);

Serial.println("Done!...");

gprsSerial.flush();

Serial.flush();


// attach or detach from GPRS service 

gprsSerial.println("AT+CGATT?");

delay(100);

toSerial();



// bearer settings
gprsSerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");

delay(2000);

toSerial();



gprsSerial.println("AT+SAPBR=3,1,\"APN\",\"Kolbi3g\"");

delay(2000);

toSerial();


// bearer settings
gprsSerial.println("AT+SAPBR=1,1");

delay(2000);

toSerial();

}

void loop()

 {

 gprsSerial.println("AT+HTTPINIT");

 delay(2000); 

 toSerial();

 gprsSerial.println("AT+HTTPPARA=\"URL\",\"https://miProyexto-c4efd.firebaseio.com\"");

 delay(2000);

 toSerial();


 // set http action type 0 = GET, 1 = POST, 2 = HEAD
 gprsSerial.println("AT+HTTPACTION=0");

  delay(6000);

   toSerial();

 gprsSerial.println("AT+HTTPREAD");


 delay(1000);


 toSerial();

 gprsSerial.println("");

 gprsSerial.println("AT+HTTPTERM");

 toSerial();

 delay(300);


 gprsSerial.println("");

 delay(10000);

 }

 void toSerial()

 {

 while(gprsSerial.available()!=0)

 {

 Serial.write(gprsSerial.read());

 }

 }
asked by AndreyC1995 04.12.2017 в 20:28
source

0 answers