To use Arduino libraries, you will need to convert the code to Flowcharts. Some Arduino code can be used directly in C-code icons. These will not simulate in Flowcode. To include simulation, you would need to re-write the library code as a flowchart within Flowcode. And if you wanted this code to be available for multiple projects, then you should create a component.
The "C to Flowchart" feature will convert many types of C code, but not everything. Also, it will not convert C++ specific code. Anything it cannot convert will remain in C-code icons.
[SOLVED] using Arduino libraries in Flow code. Few questions about Flowcode functinalities
-
- Matrix Staff
- Posts: 1509
- http://meble-kuchenne.info.pl
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 211 times
- Been thanked: 350 times
Re: Few questions about Flowcode functinalities
Thanks Steve! that helped a lot. I've got a few follow up questions if you don't mind
As I understand thus far, to include an Arduino library, I have the following options:
To use supplementary code in projects options, would it just work to copy libraries' (.h) files into Definitions and function declarations and copy libraries' (.cpp) files into Function implementations?
Thanks Again!
Must convert the library code? or the Arduino code? if it's the Arduino code, then is there a Flowcode libraries folder to put the arduino libraries files in?Steve-Matrix wrote: ↑Mon Jun 16, 2025 11:20 amTo use Arduino libraries, you will need to convert the code to Flowcharts.
ok, simulation necessates implementation in flowcharts.Steve-Matrix wrote: ↑Mon Jun 16, 2025 11:20 amSome Arduino code can be used directly in C-code icons. These will not simulate in Flowcode. To include simulation, you would need to re-write the library code as a flowchart within Flowcode.
Clear.Steve-Matrix wrote: ↑Mon Jun 16, 2025 11:20 amAnd if you wanted this code to be available for multiple projects, then you should create a component.
Clear.Steve-Matrix wrote: ↑Mon Jun 16, 2025 11:20 amThe "C to Flowchart" feature will convert many types of C code, but not everything. Also, it will not convert C++ specific code. Anything it cannot convert will remain in C-code icons.
As I understand thus far, to include an Arduino library, I have the following options:
- Write/implement the library as a flowchart
- Create a component. Which is the most proper way of doing it
- Copy the library code (the .h followed by the .cpp file) into a C-code icon. But doesn't this mean the C-code icon would need to compile/run before the main flowchart/macro? otherwise, the library declarations wouldn't work.
- Use supplementary code option in projects options (I forgot to ask about this one)
To use supplementary code in projects options, would it just work to copy libraries' (.h) files into Definitions and function declarations and copy libraries' (.cpp) files into Function implementations?
Thanks Again!
-
- Matrix Staff
- Posts: 1509
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 211 times
- Been thanked: 350 times
Re: Few questions about Flowcode functinalities
"Convert the library code" means you would need to understand what the code is doing and then write it within Flowcode as a flowchart. There's no simple way to make the code work as-is within Flowcode.
The C-to-Flowchart feature can help convert most of the C/C++ code. But it will not convert everything.
A C-code icon is a flowchart icon within your flowchart. You can add C-code statements there.
You can also add C-code to the Supplementary Code boxes. This is usually used for larger blocks of code - e.g. functions that you want to call from within your flowchart. Code here will be ignored during simulation. Typically you could copy the ".h" to the 'declarations' section and the ".c" code to the 'implementations' section.
The code is passed directly to the underlying C compiler and so any non-standard C code in the Arduino library will cause compilation errors. There is some cross-over between C and C++, but they are not the same language. C++ code could contain many features that are not understood by the C compiler.
The C-to-Flowchart feature can help convert most of the C/C++ code. But it will not convert everything.
A C-code icon is a flowchart icon within your flowchart. You can add C-code statements there.
You can also add C-code to the Supplementary Code boxes. This is usually used for larger blocks of code - e.g. functions that you want to call from within your flowchart. Code here will be ignored during simulation. Typically you could copy the ".h" to the 'declarations' section and the ".c" code to the 'implementations' section.
The code is passed directly to the underlying C compiler and so any non-standard C code in the Arduino library will cause compilation errors. There is some cross-over between C and C++, but they are not the same language. C++ code could contain many features that are not understood by the C compiler.