Combining Sketches

Are there any rules or etiquette to follow when combining sketches?
If you find sketches as examples, or in the forums, and together they achieve your aims, what is the process in combining and loading them together.
For example; you use a power monitor sketch, then decide to add a LCD display, is there a set protocol?
I've been fairly lucky so far, after reading about the basic sketch format, but can't help but think that I could have done it better.

Are there any rules or etiquette to follow when combining sketches?

(my opinion) No, except respect licenses and give credits were they are due

robtillaart:

Are there any rules or etiquette to follow when combining sketches?

(my opinion) No, except respect licenses and give credits were they are due

Rob, how do you workflow the process?

I'm not sure what "Workflow the process" means.

There probably isn't a one-size fits all answer to combing sketches. Like all things engineering related, the answer is going to be depends.

What would you do if two pieces of code use the same hardware resource (say a timer) but in different ways? One uses a pin for input while the other uses the same pin for output? What if one piece of code is a state machine based on millis() while the other uses delay()?

In none of those cases can you just copy and paste snippets of code together. Instead you have to start with defining the problem and finding a way to solve it.

So it's time well spent working through each sketch line by line, and trying to understand how each sketch works to establish compatibility between the two. That can be quite daunting, if like me, you are just learning, but I suppose that's how the learning process works!