ESP32 sensor to Ubidots

Hello, I am starting a MQTT project using esp32 and humidity sensor, I want to be able to send data from my sensor to my Ubidots dashboard, however it is really confusing for me as im a beginner. I would appreciate any form of help to help integrate the Ubidots code to my arduino code.

Heres my progress so far without adding the Ubidots code yet.

const int buzzer = A5; //buzzer to arduino pin 5
const int RELAY_PIN = A18;
const int led = A17;

void setup()
// put your setup code here, to run once:
pinMode(buzzer, OUTPUT); // Set buzzer - pin 5 as an output
pinMode(led, OUTPUT);

void loop()
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A4);
float voltage = sensorValue;

if (sensorValue < 2700)
tone(buzzer, 100); // Send 1KHz sound signal…
digitalWrite(RELAY_PIN, LOW);
digitalWrite(led, HIGH);
noTone(buzzer); // Stop sound…
digitalWrite(RELAY_PIN, HIGH);
digitalWrite(led, LOW);

Hello there,
Thank you for posting at our Community Forum.

Since you say that you’d like to integrate your code with Ubidots’ code, I suppose you’ve already seen our ESP32 guide for sending data to Ubidots through MQTT, but if that isn’t the case, then here’s the guide I’m referring to.

Now, before integrating the Ubidots code, I think that’s it’s important to first clear out what is it that you want your code to do. Do you want constant updates of the sensorValue to Ubidots, or do you only want to update the value if a condition is met? The answer to this question will affect how the code will look.

Generally speaking, what I would recommend that you do is test each code by itself, then start copying the setup() and loop() portion of one of them and paste it into the same sections of the other. This is a better detailed guide on how to do that.

I’ll be attentive in case you need any additional help.

Best regards,

Hi thank you so much for replying to my question, first of all, I have seen the guide already and I want constant updates of the sensorValue to Ubidots.
However now a new problem has arised, it is saying that
“call of overloaded 'abs(long unsigned int) in ambiguous” in the error messages
Would you be kind enough to provide some additional help. Thank you so much.