Gas sensor trigger not working

I have a gas sensor and the notification triger not working
my code is

//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>

// WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";

#define SENSOR_PIN 0
#define VIRTUAL_CHANNEL 1

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(username, password, clientID);
}

void loop()
{
  Cayenne.loop();
}

// This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL)
{
  Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(SENSOR_PIN), "o3", "ppm");
}

is your trigger counter incrementing on your trigger page.

Sorry i cannot understand, what you mean by trigger counter incrementing?


check if this value is incrementing.

ΟΚ, no it is 0

can you private message me your cayenne email.

change this

to:

Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(SENSOR_PIN), "analog_sensor", "null");

Remove the existing widget and when you run the code it will create a new widget.
Delete the existing trigger and add a new trigger for the new widget.

thank you. You are perfect!!

1 Like