How can i convert this code into an widget for cayenne


#1

The code below demonstrate an MQ135 gas sensor detecting CO2 in the air in the unit PPM. I am trying to make these values display on my phone using cayenne while my arduino is connected serial with an usb.

int sensorValue;
float vol;

void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.println("");
sensorValue = analogRead(A0);

Serial.print(“PPM =”);
Serial.print(sensorValue);

delay(1000);
}


#2

have a look at this https://github.com/myDevicesIoT/Cayenne-MQTT-Arduino/blob/master/examples/Connections/SerialUSBConnection/SerialUSBConnection.ino

but it is bit difficult to use serial usb connection, so i would suggest getting a ethernet or wifi shield and then connect to cayenne.