NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » Multi sensors part two the code
April 01, 2010 by Ralphxyz |
I got the cabling thought out and made up (still getting a 10 degree higher reading on 50' Cat5 but I'll try the R-C Damper. Now I need help with the coding (really really need help). I am just learning C and microprocessor programing. I have done some VB and C# but mostly web page stuff. in other words I do not know what I am dong I using cut and paste from working projects. I added the code sample from /thread/6 to the tempsensor project. Essentially I just commented out the while(1) and subsituted the sample code:
*/
Here is the error I get: Thanks for the help I need it. Ralph |
---|---|
April 01, 2010 by bretm |
You have a closing curly brace right before "return 0" at the end. This closes off the main() function, so it's complaining that the "return" is in the wrong place. You should just be able to delete it. Also, adc_read actually returns the value of the previous conversion and then starts the next conversion. So your sensor1 value is from ADMUX=1 and your sensor2 value is from ADMUX=0, except for the first time through the loop. That may not be a problem as long as you're aware of the inconsistency. |
April 01, 2010 by Ralphxyz |
duh, I suspected it was that but I specifically traced the curly back and thought that it was correct. I should have just deleted it and seen what would have happened. Thank you, so much, this will really help me move on my project which is gong to be needed soon. No problem with the previous conversion I will allow for it and will be taking action only on a 15 minute delay. This is great, ta dah Ralph |
April 02, 2010 by Ralphxyz |
I have working code BUT the readings are not what I am expecting. I tried using the sampleToFahrenheit code from the tempsensor project but that gives me 00 or a blank screen. So what do I need to do? I tried using the averaging routine:
But that also gave me a blank screen. With PC0 at V+ and PC1 at GRN I get A = 153 B = 00. B is correct but A should be 492. Yes, I barely know what I am doing so I do appreciate the help. Ralph |
Please log in to post a reply.
Did you know that first-order systems have a exponentially decaying response to step inputs? Learn more...
|