Ubidots Community

Counter IoT ESP8266

Good morning, I need help.

I am using ESP8266 as a pulse counter
based on a code i found in your community with analog input D0.

Which for lack of my own knowledge is difficult for me to configure the synthetic variable in the ubidots panel, I upload an image to explain in detail:

I want the count setting to be every 8 hours, but apparently I am doing something wrong.

`/****************************************

  • Include Libraries
    ****************************************/
    #include “UbidotsESPMQTT.h”

/****************************************

  • Define Constants
    ****************************************/
    #define TOKEN “BBFF-164QkjoSlO5ywd5fyfsgzO8gT” // Your Ubidots TOKEN
    #define WIFINAME “INFINC251” //Your SSID
    #define WIFIPASS “Oom1G” // Your Wifi Pass

Ubidots client(TOKEN);

/****************************************

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

void callback(char* topic, byte* payload, unsigned int length) {
Serial.print(“Message arrived [”);
Serial.print(topic);
Serial.print("] ");
for (int i=0;i<length;i++) {
Serial.print((char)payload[i]);
}
Serial.println();

}

/****************************************

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

void setup() {
// put your setup code here, to run once:
//client.ubidotsSetBroker(“industrial.api.ubidots.com”); // Sets the broker properly for the industrial account
client.setDebug(true); // Pass a true or false bool value to activate debug messages
Serial.begin(115200);
client.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
}

void loop() {
// put your main code here, to run repeatedly:
if(!client.connected()){
client.reconnect();
}

float value1 = analogRead(A1);
client.add(“temperature”, value1);
client.ubidotsPublish(“my-new-device”);
client.loop();
float value1 = analogRead(A0);
client.add(“temperature”, value1);
client.ubidotsPublish(“my-new-device”);
client.loop();
}`

Hi @Moi,

I hope all is well,

Can you please let me know your username and the device name so I can investigate what could be the error with the synthetic variable? (you can send me this data through a private message) Additionally, if you are a STEM user please remember that data range expressions are only available in Ubidots paid licenses.

All the best,
-Isabel