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(RELAY_PIN, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A4);
float voltage = sensorValue;
Serial.println(voltage);
if (sensorValue < 2700)
{
tone(buzzer, 100); // Send 1KHz sound signal…
digitalWrite(RELAY_PIN, LOW);
digitalWrite(led, HIGH);
}
else
{
noTone(buzzer); // Stop sound…
digitalWrite(RELAY_PIN, HIGH);
digitalWrite(led, LOW);
}
}