-->
Page 4 of 5

Re: publishing variables to MQTTBOX

PostPosted: Wed Jan 17, 2018 11:06 pm
by Gdipstick
thanks for the tips and your patience with this noob :? ... i'm zeroing in on a solution, using the following:

1. itoa(rgbLed.redMappedValue,str,10);
or
2. String(rgbLed.redMappedValue).c_str();
client.publish("OsoyooDataF", str);

line 1 gives me 255 which is the range of the RGB LED from the setup;

analogWriteRange(255);

Line 2 gives me a blank field, still encouraging though because we are at least publishing something....

still tinkering with this, but logging out for now, can you offer me any more hint :idea: s?

Re: publishing variables to MQTTBOX

PostPosted: Thu Jan 18, 2018 8:31 am
by schufti
if at all, version 2 should look like

client.publish("OsoyooDataF", String(rgbLed.redMappedValue).c_str());

Re: publishing variables to MQTTBOX

PostPosted: Thu Jan 18, 2018 6:39 pm
by Gdipstick
step in the right direction, i'm getting an output, but it's the range value of 255 rather than the actual mapped value, almost there :!:

Re: publishing variables to MQTTBOX

PostPosted: Fri Jan 19, 2018 11:08 am
by schufti
as I don't now where in your sketch this line ended up, it can be everything.
Most likely the client.publish is happening at the wrong time/place where/when the wanted value is not (yet) / no longer stored in the published variable.
Do a serial.print at the same location and check if the variable holds the expected value.