Hi all,
I have a question about Fona 808 (https://www.adafruit.com/products/2542) and Arduino Nano. I’m using the following code:
#include <UbidotsFONA.h>
#include <SoftwareSerial.h>
#define APN "MY_APN" // The APN of your operator
#define USER "" // if your apn doesnt have username just leave it ""
#define PASS "" // if your apn doesnt have password just leave it ""
#define TOKEN "MY_TOKEN" // Replace it with your Ubidots token
Ubidots client(TOKEN);
void setup() {
Serial.begin(115200);
delay(2000);
Serial.println("Inicializando Dispositivo...!!!");
while(!client.setApn(APN, USER, PASS));
}
void loop() {
Serial.println("Dentro del Loop...!!!");
float value1 = analogRead(A0);
float value2 = analogRead(A1);
char context[25];
char context_2[45];
sprintf(context, "lat=%s$lng=%s", char(1.1232), char(4323.123));
// To send latitude and longitude to Ubidots and see it in a map widget
// The format of the context is like this, you must send it like this example
sprintf(context_2, "Temperature=Value_Of_Temperature$Position=Value_Of_Position$Color=Value_Of_Color");
// You can send multiple context in one variable, to send it you must add a "$" symbol between every context
client.add("Variable_Name_One", value1, context); // Change for your variable name
client.add("Variable_Name_Two", value2, context_2);
client.sendAll();
delay(5000);
}
and the device is performed setup() options every time it sends variables:
Response of FONA:
OK
Response of FONA:
+SAPBR: 1,1,"10.186.29.42"
OK
Dentro del Loop...!!!
FONA/2.0|POST|EPPokxfymQUNuowFkaLPKSdeNtFci8|FONA=>Variable_Name_One:363.00$ue_Of_Position$Color=Value_Of_Color,Variable_Name_Two:327.00$Temperature=Value_Of_Temperature$Position=Value_Of_Position$Color=Value_Of_Color|end
Response of FONA:
OK
Response of FONA:
OK
CONNECT OK
Response of FONA:
>
Response of FONA:
Error sending variables
Inicializando Dispositivo...!!!
Attempting to open comm with ATs
Response of FONA:
ÿ
Error
Response of FONA:
AT
OK
+CPIN: READY
The values are uploaded OK, but I dont know if this is OK. I’m talking about rebooting.
Thanks in advance.