Ubidots Community

CC3200 Library Error

hola no logro hacer funcionar los ejemplos de CC3200 “SendValuesHttp”
envió datos a la plataforma y solo me envía datos nulos “0.00”
adjunto link de imágenes capturadas, por favor ayuda urgente.
https://drive.google.com/drive/folders/1GVOQzMtXjpo1zt_8N931ViOpGZDpRT2i?usp=sharing

Hello @fernandoLHC3,

Sorry to answer you in English, we try our answers to reach as many people as possible, and English is the default language to achieve that.

First of all, I’d like to recommend some changes to rule hidden errors, or simply improve the code.

  1. Please make sure you’re using the latest version of CC3200 library
  2. Change the constructor of the Ubidots library from ubidots(UBIDOTS_TOKEN, UBI_EDUCATIONAL, UBI_HTTP) to ubidots(UBIDOTS_TOKEN, UBI_HTTP). This is because even if the library still supports the UBI_EDUCATIONAL flag, doing so points the request to things.ubidots.com and this URL, while functional, is not the official API URL.
  3. Uncomment line 32 (ubidots.setDebug(True); ) to print all of the library’s debug messages. This will give more information concerning the code execution.

Also, based on what I see on your Serial monitor, some values are being sent in a scientific notation that are, for practical purposes, zero, which may be a reason for your Ubidots variable to show zero values.
In that same line, it’s quite strange that even though you’re fixing the float values of value1 and value2, the payload shows such a small value (e-315 ). Please, bear in mind that our platform supports up to 16 decimal places and you can configure it at the account settings. In order to help you further, can you please share your entire code after making the changes I previously recommended, as well as a screenshot of the Serial monitor?

All the best,
Ángela

Hello @angelagallego97, nice to meet you :smiley:
Thanks for answering me, now if in English :grinning_face_with_smiling_eyes:

  1. Liberia CC3200 is the latest version 3.0.0
  2. Now load the example without modifying the code (“SendValuesHttp”)
  3. Follow your instruction to uncomment line 32
  4. The example (“SendValuesHttp”) does not work correctly
    Attached serial monitor capture …
    I hope your help thanks :pray:

// This example sends data to multiple variables to
// Ubidots through HTTP protocol.

/****************************************
 * Include Libraries
 ****************************************/

#include "Ubidots.h"

/****************************************
 * Define Instances and Constants
 ****************************************/

const char* UBIDOTS_TOKEN = "BBFF-qKSrqegviH1VBvi5e9UtQk294LRszX";  // Put here your Ubidots TOKEN
const char* WIFI_SSID = "COMTECO-95856600";      // Put here your Wi-Fi SSID
const char* WIFI_PASS = "IGKVE60333";      // Put here your Wi-Fi password
Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);

/****************************************
 * Auxiliar Functions
 ****************************************/

// Put here your auxiliar functions

/****************************************
 * Main Functions
 ****************************************/

void setup() {
  Serial.begin(115200);
  ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
  ubidots.setDebug(true);  // Uncomment this line for printing debug messages
}

void loop() {
  float value1 = random(0, 9) * 10;
  float value2 = random(0, 9) * 100;
  float value3 = random(0, 9) * 1000;
  ubidots.add("Variable_Name_One", value1);  // Change for your variable name
  ubidots.add("Variable_Name_Two", value2);
  ubidots.add("Variable_Name_Three", value3);

  bool bufferSent = false;
  bufferSent = ubidots.send();  // Will send data to a device label that matches the device Id

  if (bufferSent) {
    // Do something if values were sent properly
    Serial.println("Values sent by the device");
  }

  delay(10000);
}

Hi @fernandoLHC3

Please replace the loop function with the one below and share with us the screenshot of the Serial Monitor, the only change that we made was that we print the values before the ubidots.add to analyze if the problem is the random() function or the ubidots.add() function.

void loop() {
  float value1 = random(0, 9) * 10;
  float value2 = random(0, 9) * 100;
  float value3 = random(0, 9) * 1000;
  Serial.println(value1);
  Serial.println(value2);
  Serial.println(value3);
  ubidots.add("Variable_Name_One", value1);  // Change for your variable name
  ubidots.add("Variable_Name_Two", value2);
  ubidots.add("Variable_Name_Three", value3);

  bool bufferSent = false;
  bufferSent = ubidots.send();  // Will send data to a device label that matches the device Id

  if (bufferSent) {
    // Do something if values were sent properly
    Serial.println("Values sent by the device");
  }

  delay(10000);
}

Hi @angelagallego97
here is the capture:

Hi @fernandoLHC3

Thank you for helping us with the screenshot.

According to the information of your Serial Monitor, it seems that there is a mistake with the Ubidots library or in the compiler that is changing the values generated by the random() function to very small values (that are almost zero) because, as you can see, the values printed are normal (40, 700, 5000) but then, when the payload is printed, those values change. We will check this library with our team and once we have an answer or solution to this problem we will get back to you.

1 Like

Hi @angelagallego97,
Perfect thanks, I’ll be attentive to you :slightly_smiling_face: