58-RGB (Red-Green-Blue) (Kırmızı-Yeşil-Mavi) Led Uygulaması

RGB led Kontrol
                    

int red=9;
int green=10;
int blue=11;
 
void setup() {
 
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
 
void loop() {
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
delay(1000);
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
digitalWrite(blue, LOW);
delay(1000);
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, HIGH);
delay(1000);
}

Potansiyometre ile RGB led kontrol
                    

int red=9;
int green=10;
int blue=11;

int pot1=A0;
int pot2=A1;
int pot3=A2;

int potdeger1;
int potdeger2;
int potdeger3;
 
void setup() {
 
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
 
void loop() {
  potdeger1=analogRead(pot1);
  potdeger1=map(potdeger1, 0, 1023, 0, 255);
  analogWrite(red, potdeger1);
  
  potdeger2=analogRead(pot2);
  potdeger2=map(potdeger2, 0, 1023, 0, 255);
  analogWrite(green, potdeger2);
  
  potdeger3=analogRead(pot3);
  potdeger3=map(potdeger3, 0, 1023, 0, 255);
  analogWrite(blue, potdeger3);

}