Fikret
Published

RGB Color Mixer Arduino Project

Color combination demonstration project for kids.

BeginnerFull instructions provided5 hours889
RGB Color Mixer Arduino Project

Things used in this project

Hardware components

Arduino Leonardo
Arduino Leonardo
×1
RGB Power LED
×1
Darlington High Power Transistor
Darlington High Power Transistor
×1
PCM1602 Char LCD
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Knife, twizer, Drill Machine, Solder, Glue

Story

Read more

Schematics

RGB Arduino Schematic

Code

RGB Arduino Codes

Arduino
RGB Arduino Leonardo Board
#include <LiquidCrystal.h>

//LCD backlight için pwm pini
#define pinDimm 13
//LCD backlight için pwm değeri
int dimm;
//POT değerlerini aktarmak için pin eşleştirme
#define red A0
#define green A1
#define blue A2

//LED renklerini kullanmak için pin ataması
#define redLed 10
#define greenLed 11
#define blueLed 9

//LED pwm değerleri
int redVal,redEx;
int blueVal,blueEx;
int greenVal,greenEx;

//LCD Display bağlama
LiquidCrystal lcd(2,3, 4, 5, 6, 7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("TOBB Fen Lisesi");
  dimm=100;
  //LCD backlight pwm
  analogWrite(pinDimm,dimm);
  delay(2000);
}
void loop()
{
  //Potansiyometreleri oku, değişiklik varsa yeni değeri yaz.
  redEx=redVal;
  blueEx=blueVal;
  greenEx=greenVal;
  //Minimum ve naksimum değerleri ayarlama
  
  redVal=map(analogRead(red),0,1024,0,25);  
  blueVal=map(analogRead(blue),0,1024,0,25); 
  greenVal=map(analogRead(green),0,1024,0,25); 
  
  if((redEx!=redVal)||(blueEx!=blueVal)||(greenEx!=greenVal))
  {
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("TOBB Fen Lisesi");
    
  
    lcd.setCursor(0,1);
    lcd.print("R");
    lcd.print(redVal,DEC);
    
    lcd.setCursor(6,1);
    lcd.print("G");
    lcd.print(greenVal,DEC);
  
    lcd.setCursor(12,1);
    lcd.print("B");
    lcd.print(blueVal,DEC);
  
    analogWrite(redLed,redVal);
    analogWrite(greenLed,greenVal);
    analogWrite(blueLed,blueVal);
  }
  delay(100);
}

Credits

Fikret

Fikret

24 projects • 37 followers
fidenetgaraj.blogspot.com

Comments