This library requires Arduino v1.6.0 or higher This version is not compatible with 1.2 version of the library
This is a library for the Adafruit FONA Cellular GSM Breakouts:
These modules use TTL Serial to communicate, so at least 2 pins are required to interface the FONA with your Arduino board.
FONA | Arduino UNO |
---|---|
Vio | 5V (or 3V, if your Arduino has 3V logic) |
GND | GND |
FONA_RX | Pin 2 |
FONA_TX | Pin 3 |
FONA_RST | Pin 4 |
FONA_KEY | GND |
Before continuing, make sure your device can connect to the Internet! You can run Adafruit's example "FONAtest.ino" contained in Adafruit's FONA library to make sure your FONA is working properly and is able to connect to your mobile network.
Once you see some activity, go to your Ubidots account to check your data!
To manually install the libraries, copy the Ubidots_FONA folder contained in the ZIP file into your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library, then restart the IDE.
If you're not sure how to add a library to the Arduino IDE please click here to see the steps as explained by Arduino.
You can contact support@ubidots.com for any inquiries, please specify your Mobile operator and provide the dump of the Serial Monitor fo r debugging purposes.
setDeviceName(char *device_name)
Assign a new device name. The device name by default is "FONA". Note that blank space (" ") and underscore ("_") characters are not allowed
void setDeviceLabel(char *device_label)
Assign a new device label. The device label by default is "FONA"
setDebug(bool debug)
Activate or deactivate debug messages using a bool flag.
add(char *variable_label, double value)
Add a variable with a value. This method will save the variables labels with it respective value to be sent to Ubidots.
add(char *variable_label, double value, char *ctext)
Add a variable with a value and context [optional].
e.i: client.add("position", 1.00 , "lat=37.77$lng=-122.43");
add(char *variable_label, double value, unsigned long timestamp_val)
Add a variable with a value and timestamp [optional]
e.i: client.add("sensor", 1.00 , 1509537600);
add(char *variable_label, double value, char *ctext, unsigned long timestamp)
Add a variable with a value, context, and timestamp [optional]
sendAll()
Send all data of all variables that you saved using the method *add(char variable_label, double value)**. This method returns true on success, false upon error.
getValue(char* device_label, char* variable_label)
Return the last value from a specific variable; the value returned is float type.