Send byte or unsigned with MQTT?


I use the librairy PubSubClient for the MQTT.
I send string, and it works very well :

 sprintf(TimeString, "%02d:%02d",RTC_hour,RTC_minute);
 mqttClient.publish("jeedom/swim/out/hour", TimeString);

I wan't to sebd byte or unsigned int, but it not works

mqttClient.publish("jeedom/swime/out/ph" , (byte*) &PHvalue, sizeof(PHvalue));

the value is : image

where is the error ?

Please post complete sketches showing how you send the data deal with the received data

byte outmsg[]={0xff,0xfe};
boolean rc = mqttClient.publish("test", outmsg,2); >> Using the Arduino PubSub MQTT Client (

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