MQTT client.publish format

Wonder if someone could help with this;

for (int i = (noOfTriacs - 1); i >= 0; i--)
{
triacState[i] = TRIAC_OFF;
digitalWrite(pinForTrigger[i], triacState[i]);
client.publish("Frequency","Frequency [i] off");
}

In the last line I'm wanting [i] to be the actual value of i sent.

Take a look at the sprintf() function

1 Like

Thank you, perfect.

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