PComp :: Digital I/O

Digital Input/output.

After the Brooklyn tornado, I decided to try something with wind.

finally, the circuits. The digital input is the paper wind mill, it closes the switch when the red wire touches the lumps in the back of the mill. Ground is always touching the aluminum paper on the back.

When the switch is closed, the red led lights up and the green turns off… and vice/versa when the switch is open.

videos:

code:

int pinInput = 9;
int led1=10;
int led2 = 11;
int led3 = 12;
int leerIN;

void setup(){
pinMode(pinInput,INPUT);
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(13,OUTPUT);
}

void loop(){
leerIN = digitalRead(pinInput);
if(leerIN == HIGH){
//circuit closed
//light red led
digitalWrite(led1,HIGH);
//off green led
digitalWrite(led2,LOW);
//wait a littel
delay(50);
}
else{
//circuit open
//off red led
digitalWrite(led1,LOW);
//on green led
digitalWrite(led2,HIGH);
//wait a littel
//delay(500);
}
}

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s