KamilCaliskan / arduino

0 stars 0 forks source link

led_karasimsek.ino #1

Open KamilCaliskan opened 1 year ago

KamilCaliskan commented 1 year ago

byte count();

void setup(){ for(byte i=4;i<12;i++){ pinMode(i,OUTPUT); digitalWrite(i,0); } pinMode(2,INPUT); pinMode(3,INPUT); }

void loop(){ for(byte i=4;i<12;i++){ if(digitalRead(2)==1){ count++; if(count==12) count--; digitalWrite(count,1); } else if(digitalRead(3)==1){ count--; if(count==3) count++; digitalWrite(count,1); } delay(500); } }

KamilCaliskan commented 1 year ago

byte count=4; bool yon=1; baslandi=0;

void setup(){ for (byte i=4;i<12;i++){ pinMode(i,OUTPUT); analogWrite(i,0); } analogWrite(4,255); pinMode(2,INPUT); pinMode(3,INPUT); }

void loop(){ if(digitalRead(2)==1){//dügmeye basildiysa if(yon==1){ for(count=5;count<12;count++){ if(count-1>3) analogWrite(count-2,0); analogWrite(count-1,60); analogWrite(count,255); delay(500); } analogWrite(count-1,0); yon=0; baslandi=1; } if (baslandi==1){ for(count=10;count>3;count--){ if(count+2<12) analogWrite(count +2,0); analogWrite(count +1,60); analogWrite(count,255); delay(250); }//count=3

analogWrite(count+2,0);
yon=1;

} baslandi=0;

}