Hi all, intuitively it seems to make sense to split different parts of code to different files, so it is easier to navigate and read.

For example to have separate files for servos, controllers and web which are included in the main code, and only variables are passed through.

And if this is a good practice, how do you deal with separation of setup and loop parts? I have not found reaources on this, so thinking to ask the community.

    • dudenas@lemmy.mlOP
      link
      fedilink
      arrow-up
      2
      ·
      10 months ago

      very interesting: so if you need a particular order of the loop, you controll it via filenames… Curious to try this out. Thanks!

      • Victoria@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        3
        ·
        10 months ago

        I don’t quite understand what you mean by “controlling the loop parts.” If you mean you have a giant loop() and want to split it into parts, i suggest you first extract these parts into seperate functions, which you can then move into other files. This allows you to keep your main file and it’s loop intact, and have descriptively named functions.