Giter VIP home page Giter VIP logo

Comments (6)

hirotakaster avatar hirotakaster commented on August 16, 2024

hi, could you show your code? I did not get that.

from mqtt.

Biribu avatar Biribu commented on August 16, 2024

Sure.

I have a char array declared as:
char frameRegister[30];

Then, inside a function (which connects to my mqtt server and sends a frame):

for(i = 0; i < 30; i++) {
frameRegister[i] = 0;
}
frameRegister[0] = mac[0];
frameRegister[1] = 3;
frameRegister[2] = 5;
frameRegister[3] = 5;
frameRegister[4] = 6;
frameRegister[5] = 7;
frameRegister[6] = 0;
frameRegister[7] = 255;

client->connect("clientId");
if (client->isConnected()) {
client->publish("frame/service",frameRegister);
}

On mqtt.fx client, I just get the message until 7, no 0 and no 255.

from mqtt.

hirotakaster avatar hirotakaster commented on August 16, 2024

use like this,

uint8_t frameRegister[30];
....
client->publish("frame/service",frameRegister, sizeof(frameRegister), false, MQTT::QOS0,  NULL);

you have to tell frameRegister size to MQTT client.

from mqtt.

hirotakaster avatar hirotakaster commented on August 16, 2024

or simple version is this

uint8_t frameRegister[30];
...
client->publish("frame/service",frameRegister, sizeof(frameRegister));

try this.

from mqtt.

hirotakaster avatar hirotakaster commented on August 16, 2024

@Biribu close this issue?

from mqtt.

Biribu avatar Biribu commented on August 16, 2024

Sure.
Thank you @hirotakaster , that resolved my problem.

from mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.