Is it possible to to hide the code in Arduino IDE

Hi all,
I would like to use the Arduino IDE for firmware update and individual user parameter changes.

Is possible to "redact", "Hide" specific code lines from the Arduino IDE so that the user only see what is allowed ?

Thank you

Yes. Put the code you don't want to expose the user to under the src subfolder of the sketch:
https://arduino.github.io/arduino-cli/latest/sketch-specification/#src-subfolder
Unlike the files in the root of the sketch folder, the files under that subfolder are not shown as tabs in the ARduino IDE.

HI pert,
Supper for you to respond.
So the user will not be able to access and see the code in the SRC ?

Also, there will few lines of code in the "root" the user can change.

So after the user makes the changes, the user complies and uploads the sketch. Is that correct?

Thank you

Heratch:
So the user will not be able to access and see the code in the SRC ?

Not via the Arduino IDE. Of course, they are able to open the files in a text editor and see the code if they like.

So this isn't a solution for keeping proprietary code a secret. However, it can be very useful if you have a complex sketch and you only want to expose the average user to the code they will be likely to need easy access to. The perfect example of this is the Marlin firmware for 3D printers.

Marlin is an extremely complex sketch with hundreds of source files. The average 3D printer owner has no interest in understanding all the minute details of the Marlin code base, so having hundreds of tabs in the Arduino IDE is harmful to the target user. The average user only needs access to the files that allow them to adjust the configuration settings. So the Marlin developers put all the sketch files under the src subfolder except for the configuration files.


If you actually need to hide proprietary code, you should put it in a precompiled library. You can find the documentation of that feature here:
https://arduino.github.io/arduino-cli/latest/library-specification/#precompiled-binaries
You can then distribute your code as a library, with the sketch an example of that library:
https://arduino.github.io/arduino-cli/latest/library-specification/#library-examples

I Understand,
I wish if there was away via a "password" to lock the user from seeing the actual code.

If wishes were horses...

I think you need to examine your motivations for being so secretive about your code. It's likely your project would never have been possible if not for the tremendous generousity of thousands of open source developers.

In fact, if you examine the licenses of all the code you are using, you might find that it is not even legal for you to do this.