working with Thermistor & motion sensor

Hi, I really need help friends. I am working with a thermistor for my first project with arduino, My project is to build a mechanism of an air condition unit in a simple way. 1- use Thermistor to get the room temp and if room temp goes below 23C shut the AC off! 2- use motion sensor and if for 2 hours there is nobody in the room (sensor doesnt pick up anything) shut AC off!

How is it possible to shut AC (not real AC but i have to implement that some how) off with matching conditions above? Using thermistor, i am reading value from the sensor and I am not sure if it is the room temperature inside which is showing 30 or 29, the code follows " // Example 07: Send to the computer the values read from // analogue input 0 // Make sure you click on "Serial Monitor" // after you upload // // Copy and paste this example into an empty Arduino sketch

define SENSOR 0 // select the input pin for the

// sensor resistor

int val = 0; // variable to store the value coming // from the sensor

void setup() {

Serial.begin(9600); // open the serial port to send // data back to the computer at // 9600 bits per second }

void loop() {

val = analogRead(SENSOR); // read the value from // the sensor

Serial.println(val); // print the value to // the serial port

delay(100); // wait 100ms between // each send

} "

Thank you in advance.

When is our homework due to be handed in? Is there any good reason "val" should have global scope?

13th this monday. i really dont want to postpone my graduation because of this small simple looking project.

Working with sensors seems easy but but i have no idea how to turn on and off the AC, or how to implement the AC! he mentioned something about a relay or one other way. It is driving me crazy.
Thank you for caring awol. thank you.

edit: no reason for being global, it was just to test the thermistor. I may change the thermistor to temperature sensor.

He shoots. He scores.

First work out how many 100ms intervals there are in two hours (hint: It won't fit into an "int"). Then work out how to scale your thermistor readings to Celsius.

ok the coding shouldn't be that difficult since it is a couple of if statements one for the motion sensor one for the temperature sensor. If the conditions meet turn off the AC! What the heck am I turning off? I am not going to connect the arduino to an AC but my mechanism has to be able to power up an AC and power off an AC. AAAAAnd this is the part I dont know how to do!

edit: First work out how many 100ms intervals there are in two hours (hint: It won't fit into an "int"). -> DONE!

Then work out how to scale your thermistor readings to Celsius. -> and DONE!.

Of course, you’ve already typed the words “Arduino” and “relay” into the search box.

yeap i did but the samples that i found were not very helpful or i didnt really understand how basically the relays work. I am not even sure if relay is the answer at this point.

I am not going to connect the arduino to real AC. The mechanism that I will create with arduino has to be able to turn on off the AC that's all i think. Here what is going on in my mind is" When the conditions meet turn off -------" I just need to fill in those dots with hardware and software thats about it.

I just need to fill in those dots with hardware and software thats about it.

The hardware part of those dots is a relay. The software part is digitalWrite(relayPin, LOW);

You're welcome.

I think i will go with the powerswitch tail as many people recommended at adafruit's forum. It seems like it is easy to implement and easy coding, and not too much hardware components. I hope it will work any ideas please let me know. Thank you...