Skip to content

Instantly share code, notes, and snippets.

@ikizoglu
Created February 19, 2018 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikizoglu/c3543e2f3c20993764629c2db992a92d to your computer and use it in GitHub Desktop.
Save ikizoglu/c3543e2f3c20993764629c2db992a92d to your computer and use it in GitHub Desktop.
Arduino RGB Led Kullanımı - Karma Renkler
// ************************
// ** Kemal İKİZOĞLU **
// ************************
int kirmiziPin= 10;
int yesilPin = 8;
int maviPin = 9;
void setup() {
pinMode(kirmiziPin, OUTPUT);
pinMode(yesilPin, OUTPUT);
pinMode(maviPin, OUTPUT);
}
void loop() {
setColor(255, 255, 255); // Beyaz
delay(1000);
setColor(170, 0, 255); // Mor
delay(1000);
setColor(255, 255, 0); // Sarı
delay(1000);
setColor(0, 255, 255); // Açık Mavi
delay(1000);
setColor(128, 255, 0); // Açık Yeşil
delay(1000);
setColor(128, 0, 0); // Maroon
delay(1000);
setColor(0, 0, 128); // Lila
delay(1000);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(kirmiziPin, redValue);
analogWrite(yesilPin, greenValue);
analogWrite(maviPin, blueValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment