Sketch Organization - OilSlick/coffee_tree_monitor GitHub Wiki

Functions

In an attempt to make the Arduino sketch more modular, I have broken it out into tabs of each component's functions. For example, for the BMP180 sensor, one tab is dedicated to its functions. In this way I can more easily remove a component later if necessary.

For repeated tasks, I try to create functions to reduce the overall size of the code. However, I also occasionally create functions to create consistency and clarity. For example, I created the function WriteTSL2561IO(); which simply executes luxFeed->save(TSL2561Val);. Created the function adds extra lines to the code but when you see the function call you know that it is writing TSL2561 values to Adafruit IO. The function name follows the convention action, sensor, target.

Comments

I have also "tabbed" long-form comments. Where there are large, multi-line comments from the original authors, I try to keep them organized in their own tab/file. If I add comments, I identify them with my initials: mcw.