I 'm very new to this electronic stuff (i have 25 years experience in different software fields, specially in programming using C,C++,Java,...). Quick to the point: is it possible to do the following?:
i want to connect a temperature sensor (i think it will be a LM35) to the Arduino so that if temperature is changing from the temperature range 10-20 degree Celsius range to the area of 20-30 degree Celsius or to 0-10 degree Celsius a routine should be called.
Suppose we have a current temperature of 25 degr. Celsius (which means it is in the range 20 to 30). If the temperature is rising to 29 nothing should happen. But as soon as the temperature gets 31, a routine should be called (which will -hopefully- do some calibration to the crystal). Suppose temperature is falling again to 29, the same routine should be called (to do again some calibration to the crystal).
I know that i could put everything in an endless loop, but my problem is that i need in parallel (should i say concurrent??) to the above, produce a quadratic pulse at 35kHz which has to be as accurate as possible. How to achieve this?
The first thing i thought about was using interrupts. Is this correct? Is this achievable with interrupts?
My actual problem is this: i need to create a quadratic pulse at 35kHz which should be as accurate as possible in a temperature range from 5 to 85 degrees Celsius. I already wrote a sketch using timer interrupts, uploaded it to the Arduino, heated the Arduino to aprox 50 degree Celsius and the perfect quadratic pulse went away: so i have to somehow calibrate the frequency of the crystal! I assume this is correct. isn't it?!
Thanks in advnace