AA Inter 3


Arduino by ptrii
November 8, 2011, 8:39 pm
Filed under: 2011-12, Patricia

//{input1 is a heat sensor connected to a thermometer
//output1 is a thermometer which gives you a first reading of the sensor

//input2 is a heat sensor connected to arduino
//above a certain temperature (23.5 ºC) output1 is an aquarium pump which sprays water on the model
//output2 is a switch that turns the lights off (lights are creating the heat)

//output3 is a second reading of the thermometer

T<23.5ºC – Motor OFF and Switch ON
T>23.5ºC – Motor ON and Switch OFF

 

//TestA

#include <Servo.h>;

Servo AquaPump;
Servo Switch; //Would the switch be programmed from here?

int HeatSensor=0; //heat sensor

int val;

void setup(){
AquaPump.attach(9); //this is just symbolic, at present I don’t have arduino connected to the computer
Serial.begin(9600);
}

void loop(){
val=analogRead(HeatSensor);

val=map(val,0,1023,0,179); //this are the values we used in class, I assume they are different for heat sensor and AquaPump… how can I find out?
Serial.print(val);
delay(20); //as far as I am concerned, this is in order to give time to arduino to react because otherwise it’s too fast for human eye… am I correct?

AquaPump.write(val); //In this code I never specified the temperature that activates AquaPump… where can I do that?How?
Switch.write(val); // Same here, never specified that it goes from 1 to 0
}

//Funnier is that the code works when I verify it…

 

I posted this to Apostolos but maybe someone else can help… 🙂 Or just to share really.


1 Comment so far
Leave a comment

Yup! The solution is to come on Friday, and it’s called ‘Relay’ and ‘Transistors’, by which one can attach external premade circuits such as AquaPump into arduino… (According to apostolos)

Comment by ptrii




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s



%d bloggers like this: