Air quality sensor Groove (version 1.3)

Hi i need help setup groove air quality sensor value to Cayenne, Currently using arduino yun, and grove base shield to program the sensor value . Need help with the coding part keep getting error or the values are not right.

need to provide more details: what is the error, the code you are using and any docs link to it.

This is the program code that i did

#define CAYENNE_PRINT Serial
#include <CayenneMQTTYun.h> //MQTT Arduino Yun Library

//Username,password,clientID from Cayenne webpage
//Allow Arduino to communicate with Cayenne
char username[] = "xxxxxxxxxxxxxxxxxxxxxxx";
char password[] = "xxxxxxxxxxxxxxxxxxxxxxx";
char clientID[] = "xxxxxxxxxxxxxxxxxxxxxxxx";

 #include "Air_Quality_Sensor.h"

AirQualitySensor sensor(A0);

void setup(void) {
  while (!Serial);

  Serial.println("Waiting sensor to init...");

  if (sensor.init()) {
    Serial.println("Sensor ready.");
  else {
    Serial.println("Sensor ERROR!");
Cayenne.begin(username, password, clientID);  //begin communication between Arduino and Cayenne
void loop() {

 int quality = sensor.slope();

  Serial.print("Sensor value: ");

  if (quality == AirQualitySensor::FORCE_SIGNAL) {
    Serial.println("High pollution! Force signal active.");
  else if (quality == AirQualitySensor::HIGH_POLLUTION) {
    Serial.println("High pollution!");
  else if (quality == AirQualitySensor::LOW_POLLUTION) {
    Serial.println("Low pollution!");
  else if (quality == AirQualitySensor::FRESH_AIR) {
    Serial.println("Fresh air.");

//VirtualWrite allow you to display the data collected to the Cayenne Cloud
  // and display it on your mobile and computer
    Cayenne.virtualWrite(1,**sensor**, "Air", "ppm"); // This part is i am stuck with if i use quality get 3 for value if use sensor get exit status 1
    delay (2000);

i guess this should help you understand the code properly why you are getting value 3 when used quality Grove - Air Quality Sensor v1.3 - Seeed Wiki
the error when using sensor is because you have not initialized it in the code and you are using it. replace it with sensor.getValue() and it should solve your issue.


Ohh thanks it works