Arduino DesRangile Devresi
void setup() {
pinMode(A0, INPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
void loop() {
int pot=analogRead(A0);
if(0<=pot && pot<255)
{
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
}
else if(251<pot && pot<500)
{
digitalWrite(6,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
else if(501<pot && pot<750)
{
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
}
else if(751<pot && pot<1023)
{
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
}
0 comments:
Yorum Gönder