9/28/2007

hey, the guy behind me! did you catch my smile?

video



code:
// declare variables:
int potPin=0;
int potValue=0;
int led2=5;
int led3=6;
int led4=9;
int led5=10;
int led6=11;
int test=13;
int state = 0;
int counter=0;

void setup() {
Serial.begin(9600);
}

void loop() {
digitalWrite(test,HIGH);
potValue=analogRead(potPin);
if(potValue>100){
analogWrite(led1,(potValue/2));
analogWrite(led2,(potValue/2));
analogWrite(led3,(potValue/2));
analogWrite(led4,(potValue/2));
analogWrite(led5,(potValue/2));
analogWrite(led6,(potValue/2));
}
else {
analogWrite(led1,0);
analogWrite(led2,0);
analogWrite(led3,0);
analogWrite(led4,0);
analogWrite(led5,0);
analogWrite(led6,0);
}
delay(30);
Serial.println(potValue);
}

No comments: