Convert Node Red to C Code

Hello, is there a possibility to create C code from Node Red? My Idea is to Create C Code for Microcontrollers and other devices from specific nodes. Maybe it is possible to use the JSON File?

I have been in such an endaeveor myself. I tried searching to convert .json nodes and wires to .tick scripts. The only conclusion i found was to build a transpiler(not really)/interpretor myself.

Please keep this thread posted of you do find any. :slight_smile:

But how do you wish for this process happen? like, what nodes do you have in your nodered that you need to convert to a compilable c code.
The first thing i tried in my case was to use nodes and edit a single .tick file, adding functionality(lines to the same file), with each connection.
but the problem will still be to make it compilable and runnable.

  • order of execution cannot be maintained.
  • and syntax rules cannot be enforced.

or atlast it is too cumbersome to do the said process.

one thing you could do is build c structs from json objects like this, create a node module which would analyse the struct to create a linked data structure, then write rules explicitly on how to handle a node type, to produce a valid c file. (but nothing can be guaranteed)

These certainly exist for certain microcontrollers. Both Python & JavaScript is available.

Doesn't answer the original question really though.

There are some tools aiming to cross-compile JavaScript to C

Doubt they will be of much use but you never know.

There are also things like Haxe but that is a separate language capable of outputting several different language code types including JavaScript and C

Also see Convert javascript code to c code - Stack Overflow

hence this was replied in the first part .. @TotallyInformation

I think it does, doesnt it?

Thank you for your support. I dont know where i can get the Javascript code to cross compile it to C? I can only downlaod the JSON file?

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