Send data from C Program to Node-Red

#1

Hi,
I'm newbie to Node-Red.
I work on a Raspberry Pi3.
I developed a C program that runs on the Raspberry. I want to periodically send data to Node-Red.
What is the best way.
Thank you for your comeback.

0 Likes

#2

I would look at using MQTT. I am sure there must be an MQTT library for C.

0 Likes

#3

Lots of ways to do this. I suggest expanding your requirements which might help us give more focused help.

0 Likes

#4

Thank you Colin and Julian.
I am rather electronic.
I made an embedded device and I want to make a graphical interface (web server) to view 2 parameters, every 500 ms. These 2 parameters are the result of a calculation from my C program. The C program and the web server (with Node-RED) runs on the same Raspberry.
I think that eventually I will also use the web server to pass parameter to my embedded device, for its configuration.

0 Likes

#5

For my need, described above:
Are websockets adapted?
Is it better to investigate MQTT or another technology?
Nobody to help me?

0 Likes

#6

You could use web sockets if you are happy to code them on C. Or just a local udp connection. Or tcp. Up to you.

0 Likes

#7

There are many ways it could be done, it is likely to be a case of picking an approach you're most comfortable with.

One option that hasn't been suggested yet is to run your C program using the Node-RED Exec node, and capture whatever it prints to stdout in your node-red flow. We have a number of nodes that use that technique under the covers; they invoke a python script to interface with particular bits of hardware and use stdin/out to communicate with it.

0 Likes