Friday, November 6, 2009
003 blink frequency [arduino]
int value;//we declare a variable. we will use this to store input from analog IN
void setup(){
pinMode(2,OUTPUT);
}
void loop(){
value=analogRead(0);//input from analog PIN 0 is assigned to the variable
digitalWrite(2,HIGH);
delay(value);//we can use the above variable to change delay value dynamically. value read by analog PIN is between 0 and 1024.
digitalWrite(2,LOW);
delay(value);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment