Close

Code breakdown

A project log for ThermomUno

Turn a $20 Uno and LCD shield into a cheap thermometer!

ted-russTed Russ 08/03/2015 at 02:441 Comment

As I want to use this for several projects, I'm working to break down the one big loop into subroutines. ( aka functions )

The sensor reading could be done inline but then it's not quite as universal as it will be once I abstract out the hardware specific stuff. Because then, I can call ReadTemp(t,h) in my loop and just put the ReadTemp() module for the particular hardware I'm using into the code.

I'll still have to make sure the relevant library is compiled and the right input pins etc, are initialised but changing a sensor to a different type will be as easy as just including the appropriate version of ReadTemp().

This makes sense because I'd like this to be applicable to as many different sensors as possible, in combination with as many others, as possible. In particular, I want this to work with ModulUno as part of a network of sensors around my homestead that automates absolutely everything for me, so some FEPs (Front End Processors) may well do a dozen different (but overlapping between different FEPs) things, and then it's easier to have just one place in the repository to find all the code snippets.

Discussions

Ted Russ wrote 08/03/2015 at 02:48 point

Basically, I'd be making a library of these snippets, I guess. My brain's frozen atm because it's cold in Australia and I've got the mother of all head colds. Plus, I'm teaching myself the interrupt and analog stuff right now because that's all part of the Plan... 

  Are you sure? yes | no