/*

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.

*/

//EXPLAINATION: we are making a window that opens and closes based on temp, humidity, rain, and windspeed

//While we do not have the sensors

// Pin 13 has an LED connected on most Arduino boards.

// give it a name:

const int open = 12 ;

const int close = 13 ;

const int buttonPin = 2 ;

int incomingByte = 0 ;

int buttonState = 0 ;

// the setup routine runs once when you press reset:

void setup ( ) {

pinMode ( open, OUTPUT ) ; //button to provide user feedback that the window is closing

pinMode ( close, OUTPUT ) ; //button to provide user feedback that the window is closing

pinMode ( buttonPin, INPUT ) ;

}

// the loop routine runs over and over again forever:

void loop ( ) {

buttonState = digitalRead ( buttonPin ) ;

int C = 0 ; //

while ( C == 0 ) {

if ( buttonState == HIGH ) {

delay ( 500 ) ; //wait

if ( buttonState == LOW ) { //waits until button is released

digitalWrite ( close, LOW ) ; //light that signals the window is closing is off

digitalWrite ( open, HIGH ) ; //light that signals the window is opening is on

C = 1 ; //set C value to note that the window is closed

}

else {

}

}

else {

}

}

while ( C == 1 ) { //while the window is closed

if ( buttonState == HIGH ) { //if the button is pressed

delay ( 500 ) ; //pause

if ( buttonState == LOW ) { //waits until button is released

digitalWrite ( open, LOW ) ; //light that signals the window is closing is off

digitalWrite ( close, HIGH ) ; //light that signals the window is opening is on

C = 0 ;

}

else {

}

}

else {

}

}