Is there sample code of creating mesh with c++ protobufs?

Sample code preferably containing initialization of the mesh, creating a packet with the data and then sending it to other nodes.

1 Like

Get the protobufs in your project and then request the config and you will get data streamed back. The mesh is already running without your client. You send messages into the device and they will go out over the mesh.

what do you mean by config here?

Are you wanting to send your own data over the mesh? You can write your own plugin for the device firmware, or use the existing serial plugin to just send serial data over the mesh

Yes, i have connected a bunch of sensors to a heltec v2 board and I want to retrieve that data and send it over the mesh.

How do you write a plugin for the firmware? Is this using the protobufs?
What is the serial plugin?

There is an environmental measurement plugin that probably does what you want Environmental Measurement Plugin Settings | Meshtastic

Yes but my code is in cpp so I can’t use that plug-in.

The heltec v2 boards will be set remotely at a location and have to do their own data collections and transmission

Meshtastic isn’t a library you can include in an existing project, its a whole self contained firmware of it’s own (and it’s written in c++ already). What sort of sensors do you have?

Oh right.
I thought using the protobufs, we could just use it as a library but then i probably didn’t understand protobufs properly.

I have the following sensors:
humidity
temp
anemometer, wind vane
gps
compass

The protobufs only define the data structures we send back and forth. Any implementation will still need the logic that is applied to those structures.

Humidity and temp are already supported (for certain sensors). GPS is supported too. For a wind vane and compass, you could use an external Arduino of some kind to read them, and output the results via serial to the meshtastic device which will then forward it over the mesh

Can’t we have the meshtastic device take the wind sensor out and then forward it over the mesh without having two devices?

Oh right.
How come meshtastic didn’t create the logic and a library so that we can just import it and use it?

Because no one has gotten around to it yet. Happy to accept contributions :slight_smile:

The environmental plugin could be modified to take wind sensor readings. That’d be cool.

1 Like