Argon LED status not blinking when sending MQTT messages

Hi, these are some question(s) around the LED status. When my device (Argon) has a firmware which contains only a Particle.publish call, the LED is blinking and I see all the events in the console. (Normal situation).
When I change my code to submit my measurement to a MQTT server (not using particle.publish), the measurements are submitted to the MQTT broker, but the LED is not blinking.
When I add the Particle.publish entry to my code and flash the firmware to the device, both measurements (Particle console and MQTT broker) are receiving the sensor measurements , but the LED is not blinking.
I was initially confused about the status of the LED , not blinking and was thinking of network connectivity problems , but that is not the case.
It is however somewhat confusing.
Trying to understand why I see this type of behaviour
Kind regards,
Serge Vereecke

Added some code fragments

#include "MQTT/MQTT.h"

void setup() {
  //Serial.begin(9600);
  dht.begin();
  RGB.control(true);
  client.connect(System.deviceID());
  if (client.isConnected()) {
    client.subscribe("color");//color is the topic that photon is subscribed
    client.publish("fun", "Particle loaded");//publishing a data "hello" to the topic "fun"
  }
}

void loop() {
  delay(10000);
  float temp = dht.getTempCelcius();
  float humidity = dht.getHumidity();
  float f = dht.getTempFarenheit();

  // Check if any reads failed
  if (isnan(humidity) || isnan(temp) || isnan(f)) {
    Serial.println("Failed to read from DHT11 sensor!");
    return;
  }

  String sensorVals = "{humidity:" + String(humidity) + ",temp:" + String(temp) + "}";    
  //Serial.printlnf("Temp: %f", temp);
  //Serial.printlnf("Humidity: %f", humidity);
  if (client.isConnected()) {
    //  client.loop();
    client.publish("house/measure1", sensorVals);   
  }

  Particle.publish("sensorVals",sensorVals);
}

Why should the LED blink?
Your code is taking control over the RGB LED but doesn’t seem to set the color so the LED will not do anything since you are not telling it to.

1 Like

Ok, I see the RGB.control() is determining if the LED is blinking or not . Thank you for pointing out

@svereecke, the RGB.control() determines if YOUR application controls the RGB LED or the DeviceOS does. The familiar “blinking” is done by the DeviceOS.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.