Creating complex programs (merging programs)

Hello,
Im developing some software that is getting complex fast.

  • Arduino with capacitve touch input
  • Serial comms
  • Particle system
  • Projection mapping

My question is about program structure and best practise. I have all this working in seperate programs; I want to combine them all.

Should I create seperate files in one sketch folder and convert them all to classes?

My thinking is use a serial comms sketch and instanciate the other programs as objects. I realise theres many ways to do the same thing but I would like to know what others do when structuring bigger more complex programs. Is there a standard JS rule to keep to?

Thanks in advance to any advice
Chris

2 Likes

Hello!

I think that’s the right way.

Make a tab / file for the main functions setup and draw,
a tab Tools and a tab for each class.

With a class you can encapsulate the variables and functions so that they are separated, even though you instantiate only one object per class, that’s okay.

You can add new tabs / files (((in the processor IDE, not js))) in the bar where the Sketch’s name is written: There is a small arrow pointing down :small_red_triangle_down:. In the local menu choose New Tab etc.

Welcome back, cuvner! :wink:

Chrisir

2 Likes