Thursday, March 12, 2009

Particulate Gas Localization - Joe & Ivan - Project #2


Particulate Gas Localization - Project 2 - Joe Manganelli & Ivan Siles



Problems encountered:

- The water pump we bought did not have enough pressure to make the water become mist through the misters.
-


Code:

//////////////////////////////////////////////////////////////////////////////////////////

// //

// Particulate/Gas Localization - Board 1 (Ivanduino) //

// //

// Joe Manganelli and Ivan Siles //

// //

// Project #2 - Architectural Robotics (Arch879/ECE893) //

// //

// Spring 2009 //

// Clemson University, Clemson, SC //

// //

/////////////////////////////////////////////////////////////////////////////////////////

#include

// Declare all the IN/OUT pin variables

// Inputs

int Sensor = 6; //variable for ir sensor

//Outputs

int Joeduino = 5; //variable for communication with second arduino

int UV_LED = 13; //variable for UV LED

int Pump = 4; //Variable for water pump

//Servos

ServoTimer1 Bellows;

ServoTimer1 Breathers;

int Angle_Bellows = 0;

int Angle_Breathers = 0;

int Smoke = 0;

int IR = 0;

void setup()

{

Bellows.attach(9); // attaches the servo on pin 9 to the servo object

Breathers.attach(10); //attaches the servo on pin 10 to the servo object

pinMode(Sensor, INPUT);

pinMode(UV_LED, OUTPUT);

pinMode(Pump, OUTPUT);

pinMode(Joeduino, OUTPUT);

} //Close void setup

void loop()

{

digitalWrite (UV_LED, LOW); //Make sure all LEDs are OFF

digitalWrite (Pump, LOW); //Make sure Pump is OFF

digitalWrite (Joeduino, LOW); //Make sure Arduino 2 is OFF

// goes from 0 degrees to 35 degrees

for(Angle_Breathers = 0;Angle_Breathers <=35;Angle_Breathers+=1) {

Breathers.write(Angle_Breathers); // tell servo to go to position in variable

delay(20); // waits 20ms for the servo to reach the position

}

// goes from 180 degrees to 100 degrees

for(Angle_Bellows = 180;Angle_Bellows >=100;Angle_Bellows-=1) {

Bellows.write(Angle_Bellows);

delay(10); // waits 10ms for the servo to reach the position

}

while (Smoke == 0) { //If no smoke, keep updating sensor

IR=digitalRead(Sensor); //Read from Sensor

if (IR==HIGH){

Smoke=1;

}

else{

Smoke=0;

}

} //Close while

digitalWrite (Pump, HIGH); //Activate relay for the Pump

// goes from 100 degrees to 180 degrees

for(Angle_Bellows = 100;Angle_Bellows >=0;Angle_Bellows-=1) {

Bellows.write(Angle_Bellows); // tell servo to go to position in variable

delay(30); // waits 30ms for the servo to reach the position

}

digitalWrite (UV_LED, HIGH); //Activate UV_LEDs

digitalWrite (Joeduino, HIGH);

while(1) {

for(Angle_Breathers = 10;Angle_Breathers <=60;Angle_Breathers+=1){

Breathers.write(Angle_Breathers); // tell servo to go to position in variable

delay(20); // waits 30ms for the servo to reach the position

}

for(Angle_Breathers = 60;Angle_Breathers >=10;Angle_Breathers-=1) {

Breathers.write(Angle_Breathers); // tell servo to go to position in variable 'pos'

delay(20); // waits 20ms for the servo to reach the position

}

} //Close while loop

} // Close void loop

//////////////////////////////////////////////////////////////////////////////////////////

// //

// Particulate/Gas Localization - Board 2 (Joeduino) //

// //

// Joe Manganelli and Ivan Siles //

// //

// Project #2 - Architectural Robotics (Arch879/ECE893) //

// //

// Spring 2009 //

// Clemson University, Clemson, SC //

// //

/////////////////////////////////////////////////////////////////////////////////////////

// Declare all the IN/OUT pin variables

//Inputs

int Ivanduino = 5; //variable for input from Ivanduino

//Outputs

int LED_right_breather = 9; //variable for Green LED

int LED_left_breather = 10; //variable for White LED

int Signal = 0; //variable for Ivanduino

int Pin5 = 0; //variable for Pin5

int LED_rb = 0; //variable for activiating LED_right_breather

int LED_lb = 0; //variable for activating LED_left_breather

void setup()

{

pinMode(Ivanduino, INPUT);

pinMode(LED_right_breather, OUTPUT);

pinMode(LED_left_breather, OUTPUT);

} //Close void setup

void loop()

{

analogWrite (LED_right_breather, 55); //Make sure right breather lights are low

analogWrite (LED_left_breather, 55); //Make sure left breather lights are low

while (Signal == 0) { //If no smoke, keep updating sensor

Pin5=digitalRead(Ivanduino); //Read from Ivanduino

if (Pin5==HIGH){

Signal=1;

}

else{

Signal=0;

}

} //Close while

while(1) {

for(LED_rb = 55, LED_lb = 255;LED_rb <=255,LED_lb>=55;LED_rb+=4,LED_lb-=4) {

analogWrite (LED_right_breather, LED_rb);

analogWrite (LED_left_breather, LED_lb);

delay(20);

} //Close for loop

for(LED_lb = 55, LED_rb = 255;LED_lb <=255,LED_rb>=55;LED_lb+=4,LED_rb-=4) {

analogWrite (LED_right_breather, LED_rb);

analogWrite (LED_left_breather, LED_lb);

delay(20);

} //Close for loop

} //Close while loop

} // Close void loop





No comments:

Post a Comment