NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » Multiple Sensors (Temp Sensor)
February 28, 2010 by Ralphxyz |
I have seen in other threads that people were trying to use multiple sensors. Has the final code been posted anywhere? I need to have four temperature sensors. There is a chunk of [code] (http://www.nerdkits.com/forum/thread/6/) that the intent does what I need but how do I implement it? I am limited in C (I do know programming just not a lot of C). I took the code chunk and appended it to the Temperature Sensor project, but do not know if it is actually working or how to clean it up. What do I do with the sample code? In the Temperature Sensor project an averaging loop is run wich seems like a good idea how would I average sensor2? Sensor one I can just use the Temperature Sensor code but what about sensor2. Here is what I have done, this does compile but the LCD display is obviously messed up and I really do not know it is what it is actually showing, PC0 is input grom a LM35, PC1 is at ground:
return 0; I am building a solar water heater and I need a differential temperature controller to turn a circulator on and off. If the array water temperature is 30 degrees >the tank temperature turn the circulator on else leave it off or turn it off. sorry about the length of this post my head is sort of swimming around with so much code and such. Thanks, Ralph |
---|---|
February 28, 2010 by BobaMosfet |
Set ADMUX to the channel you want to read, then reinit it. Other code is the same except how you interpret the result (based on what you've got inputting to the ADC). BM |
February 28, 2010 by Ralphxyz |
Thanks, I almost understand, I have seen some examples of setting the channel. Any samples or working projects? Ralph |
March 01, 2010 by Ralphxyz |
re: "Set ADMUX to the channel you want to read" isn't that what: ADMUX = 0 and ADMUX = 1 does? Ralph |
March 01, 2010 by pbfy0 |
well, actually |
October 12, 2010 by zrouse |
So I was looking at the code above and I have been trying to use it to have 3 leds to light up on different pins. I have 2 sensors, I want to use if then statements to do 3 different steps. First if sensor1 < sensor2
I have tried, and looked at different forums to find my answer to program this code, I just don't know how to write what else to get this started
I just need an example of how to get started then I will be good to go Thanks, |
October 13, 2010 by bretm |
There are a few ways to do it. If you're not using PORTB for anything else, you can do
If you need to preserve the other PORTB pins for other uses, you could do something like
|
October 13, 2010 by zrouse |
I just tried the code, with playing around with it a little I began to understand my mistakes and am 1 step further on my project. Thanks Bretm |
October 14, 2010 by Ralphxyz |
I posted my code for multiple temp sensors on the Pastebin site: Ralph |
Please log in to post a reply.
Did you know that you can build an analog amplifier with one transistor and a few resistors? Learn more...
|