Merging 2 projects

Ive just finished a tipping bucket flow meter sketch with the help of some members from this forum.
Its part of a bigger project which i have been working on for quite a while now. Always adding too it. This tipping bucket is the newest addition. So far it has all been contained in a single sketch and on one arduino.

I was fairly sure that i would need the tipping bucket as a new arduino as it needs to poll the switch fairly regularly and my existing sketch has a fair bit going on already (ands some delays). But after reading Several thing at one time , im wondering if i cant include my tipping bucket flow meter sketch as another routine in the other sketch and not have to use 2 arduinos to accomplish it.

Both sketches are below. I dont expect you to do it for me or anything. maybe just tell me how to work out how long it takes for the main sketch to run through, so i can see if the time it takes isnt too slow for it to also count bucket tips.

thanks.

Flow_meter.ino (2.41 KB)

still_control_t500_processing_PID_cleanCode.ino (6.04 KB)

Have a look at this demo for merging programs.

Your still_control program looks quite complex so I can't say for definite that it will work. You will need to ensure that you don't try to use the same I/O pin for two purposes and that you don't use the same global variable for two purposes.

Before the merge I would edit the smaller program and change all the variable names by adding say fm_ (or equivalent) at the start of the names. That way you can be sure there won't be any conflicts. If you do make a change like that be sure to ( a ) keep a copy of the unchanged version and ( b ) check it works after the changes.

...R