This library is to connect easily an mDot with SODAQ Autonomo
- Download Arduino IDE here
- Go to Arduino IDE File -> Preferences -> Additional Board Manager URLs and add next line there "http://downloads.sodaq.net/package_sodaq_index.json".
- Open Board Manager via Tools -> Board -> Board Manager and search for SODAQ boards, select SODAQ SAMD boards for the Autonomo.
- Download the GPRSbee library of Ubidots here
- Go to the Arduino IDE, click on Sketch -> Include Library -> Add .ZIP Library
- Select the .ZIP file of GPRSbee and then "Accept" or "Choose"
- Close the Arduino IDE and open it again.
Note: * This library uses WiFly library of SeeedStudio. For this reason I added it to this repository. * This library creates a new Ubidots data source named "SODAQWiFly", Inside that the library will save the variables.
In the next example we explain how to send a Temperature value to Ubidots API from your device. Please don't forget to change SSID, KEY, AUTH and TOKEN.
#include <SODAQWiFibee.h>
/* Change the AUTH according to your network settings
If is open change to WIFLY_AUTH_OPEN
If is WPA1 change to WIFLY_AUTH_WPA1
If is WPA1_2 change to WIFLY_AUTH_WPA1
If is WPA2 change to WIFLY_AUTH_WPA1
*/
// To add space in RN171 you just put "$" instead of " "
#define SSID "SSID"
#define KEY "PASS"
#define AUTH WIFLY_AUTH_WPA2_PSK
#define TOKEN "asdasenas12321adaxxxxx" // Replace it with your Ubidots token
Ubidots client(TOKEN);
void setup() {
client.wifiConnection(SSID, KEY, AUTH);
}
void loop() {
float value = analogRead(A0);
client.add("Tmeperature", value);
client.sendAll();
delay(1000);
}
In the next example we will explain you how to get the last value from a Ubidots variable. Please don't forget to change SSID, KEY, AUTH and TOKEN.
#include <SODAQWiFibee.h>
/* Change the AUTH according to your network settings
If is open change to WIFLY_AUTH_OPEN
If is WPA1 change to WIFLY_AUTH_WPA1
If is WPA1_2 change to WIFLY_AUTH_WPA1
If is WPA2 change to WIFLY_AUTH_WPA1
*/
// To add space in RN171 you just put "$" instead of " "
#define SSID "WIFI$SSID"
#define KEY "WiFi_Pass"
#define AUTH WIFLY_AUTH_WPA2_PSK
#define TOKEN "asdasenas12321adaxxxxx" // Replace it with your Ubidots token
Ubidots client(TOKEN);
void setup() {
client.wifiConnection(SSID, KEY, AUTH);
}
void loop() {
float value = client.getValue(ID);
delay(1000);
}