Temperature control

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
3rdpig
 
Posts: 2
Joined: Fri Oct 21, 2011 1:42 am

Temperature control

Post by 3rdpig »

Greetings! I bought the Arduino starter pack and I've been through the tutorial lessons but I seem to be hitting a wall. I'm looking for a sketch that will read a temp sensor (I have the TMP36 and the 10k precision epoxy thermistor) and at a certain temperature set one digital output to high, then at a higher temperature set it to low and at the same time set another digital output pin to high. I can read the sensor without a problem, but I'm not getting the statement that turns the digital output to high or low at certain temp readings. I know this is probably simple but I'm just not getting it and could use a push in the right direction. My end goal is a temp controlled fan system that turns a small, low speed fan on at one temperature then at a higher temp switches that fan off and switches a larger, higher speed fan on. It's eventually going to be more complex than that, but I'm trying to start at the simplest level first. If someone could give me a basic example or point me to one I'd appreciate it.

iyeager
 
Posts: 12
Joined: Sat Oct 29, 2011 8:40 am

Re: Temperature control

Post by iyeager »

http://arduino.cc/en/Reference/HomePage

You'll want to look at the digitalWrite() command.

It will look something like this,

Code: Select all

if(temp > hihi) {
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
else if (temp > hi) {
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
else {
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
in the setup loop you'll want to have a pinMode line in there to set whatever digital pins you're using as outputs.

-Ian

3rdpig
 
Posts: 2
Joined: Fri Oct 21, 2011 1:42 am

Re: Temperature control

Post by 3rdpig »

Thanks! I'll give it a shot when I get home this evening!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”