Where can I find a introductional tutorial that covers ALL details?

Hello everybody,

I followed the introductional tutorial and took the path down to a tutorial that wants to show how to use ubidots with an ESP32

the tutorial shows most steps but some parts are missing which lead to a compiler-error when I tried to compile the sourcecode

The code has two constants

const char* DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM = "DEV_LABEL";  // Replace with your device label
const char* VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM = "VAR_LABEL";       // Replace with your variable label

But the tutorial says nothing about how to setup these constants.
I did some searching on the ubidots website but with no success.

To me the userguides section and the developer-guide section looks like a messed up collection of randomly chosen examples of pretty particular customer projects.

So where can I find a tutorial on how to setup these two constants
const char* DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM = “DEV_LABEL”; // Replace with your device label
const char* VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM = “VAR_LABEL”; // Replace with your variable label

from this example-code

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

#include "Ubidots.h"

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

const char* UBIDOTS_TOKEN = "...";  // Put here your Ubidots TOKEN
const char* WIFI_SSID = "...";      // Put here your Wi-Fi SSID
const char* WIFI_PASS = "...";      // Put here your Wi-Fi password
Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);
// Ubidots ubidots(UBIDOTS_TOKEN, UBI_TCP); // Uncomment to use TCP
// Ubidots ubidots(UBIDOTS_TOKEN, UBI_UDP); // Uncomment to use UDP

/****************************************
 * 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(5000);
}

to make the code compile and successfully interact with the ubidots-server

best regards Stefan

Hi @StefanL38 ,

We extend our apologies if our article/guide seems misleading or isn’t as explicit as you’d want it. We really try to make it as clear as possible.

Now, the lines you shared:

are for making GET requests, that is, retrieving data from Ubidots, however, the code that you shared at the end of the post is for sending data to Ubidots. I’d like to know which operation are you trying to do.

On the other hand, I’d like to explain to you what the labels are. The way our system distinguishes Devices and variables from one another is through IDs, but thats a string made up of letters and numbers that is almost impossible to recognize first hand, so there is another way of distinguishing Devices and Variables, labels. The label is a string that you can setup to what you want it to be (just make sure that it doesn’t have white spaces, or special characters, it should only contain letters, hyphens or underscore). Here’s an image where you can find the Label or ID for your Devices or Variables:

Now, the code you are trying to upload to your ESP32 needs to know to what Device and Variable it wants to send data to (or retrieve data from), so you need to give it that. For example if your Device and Variable have the following labels: “esp32” and “battery”, respectively, then the lines of the code for retrieving data would be:

const char* DEVICE_LABEL_TO_RETRIEVE_VALUES_FROM = "esp32";  // Replace with your device label
const char* VARIABLE_LABEL_TO_RETRIEVE_VALUES_FROM = "battery";       // Replace with your variable label

Makes sense? I’ll be attentive to your thoughts.

Best regards,
Sebastián

Getting started with an IoT platform is hard, specially if you are dealing with multiple problems. Is the ESP32 the hardware you are going to end up using? If so, eventually you’ll have to get your code working with it. Our experience is that you get started much quicker with success, than failure. Either way, we created a lab to get started with Ubidots in minutes, not hours or days:

https://mqttlab.iotsim.io/ubidots/