Thanks for the replies so far.
Im no expert but try breaking down each particular job into a seperate function and call them from the main loop depending on the inputs you have.
So for example you have your temp sensors so I would do it like this (not real code, but you might get the idea)
Its not very brilliant but it'd work.
That's sound advice which makes sense in a very basic sketch, but it gets interesting when each function is essentially a sketch in itself (to me at least). For example, I'm not using a simple on/off for the fan, but instead a PID algorithm that adjusts the PWM output to the fan to keep constant temps without overshooting the set temperature. Ultimately, I believe what you are saying is correct but the implementation screws me up after incorporating a couple different functions
I have not seen this, however I will read through it. After a quick skim, it seems that it may take a slightly different approach at tackling this.
Also, have you read:
I have read this thread at least twice, and started reading through it again just before posting. It takes a little bit to digest, but it seems to be a very methodical approach to writing complex code. Now if I can get my non-complex mind to comprehend the code, I'll be good :sunglasses:
I think one of the things that I'm getting hung up on is passing variable into a function. Often I have a function that defines a variable in which I need to use in another function. I've read up on this, but it still confuses me each time I encounter it.
One example is the following portions of my modified checktemp.ino sketch:
void printData(DeviceAddress deviceAddress)
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
// print the device information
Serial.print("Probe 1: ");
Serial.print("Probe 2: ");
DeviceAddress is defined as:
DeviceAddress Probe1, Probe2;
however deviceAddress doesn't seem to be defined, but is used throughout the example sketch that I have modified. Maybe that's part of the #includes of that sketch??
It's the details like this that I'd like to streamline so they make more sense (to me at least).