Things used in this project

Hardware components:
09264 1
RGB Diffused Common Cathode
×1
09939 01
Rotary potentiometer (generic)
×3
11026 02
Jumper wires (generic)
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
Software apps and online services:
Ide web
Arduino IDE
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Code

arduino codeArduino
RGB
int R = A3; //pin for red LED
int G = A4; //pin for green LED
int B = A5; //pin for blue LED

int potenciometar1= A2; //pin for first potentiometer 
int potenciometar2= A1; //pin for second potentiometer 
int potenciometar3= A0; //pin for third potentiometer 

void setup()
{
  pinMode(R, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(potenciometar1, INPUT);
  pinMode(potenciometar2, INPUT);
  pinMode(potenciometar3, INPUT);  
}

void loop(){
  int x=analogRead(potenciometar1);
  int y=analogRead(potenciometar2);
  int z=analogRead(potenciometar3);
  if(x<10 && y<10 && z<10)
       BOJA(0,0,0);
  else if(x>200 && y<10 && z<10)
       BOJA(255,0,0);
  else if(x<10 && y>200 && z<10)
       BOJA(0,255,0);
  else if(x<10 && y<10 && z>200)
       BOJA(0,0,255);
  else if(x>200 && y>200 && z<10)
       BOJA(255,255,0);
  else if(x>200 && y<10 && z>200)
       BOJA(255,0,255);
  else if(x<10 && y>200 && z>200)
       BOJA(0,255,255);
  else if(x>200 && y>200 && z<200)
       BOJA(255,255,255);
}
/*
*   function BOJA(color)
*/
void BOJA(int R_RED, int G_GREEN, int B_BLUE)
{
  analogWrite(R, R_RED);
  analogWrite(G, G_GREEN);
  analogWrite(B, B_BLUE);
}
arduino codeArduino
RGB
int R = A3; //pin for red LED
int G = A4; //pin for green LED
int B = A5; //pin for blue LED

int potenciometar1= A2; //pin for first potentiometer 
int potenciometar2= A1; //pin for second potentiometer 
int potenciometar3= A0; //pin for third potentiometer 

void setup()
{
  pinMode(R, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(potenciometar1, INPUT);
  pinMode(potenciometar2, INPUT);
  pinMode(potenciometar3, INPUT);  
}

void loop(){
  int x=analogRead(potenciometar1);
  int y=analogRead(potenciometar2);
  int z=analogRead(potenciometar3);
  if(x<10 && y<10 && z<10)
       BOJA(0,0,0);
  else if(x>200 && y<10 && z<10)
       BOJA(255,0,0);
  else if(x<10 && y>200 && z<10)
       BOJA(0,255,0);
  else if(x<10 && y<10 && z>200)
       BOJA(0,0,255);
  else if(x>200 && y>200 && z<10)
       BOJA(255,255,0);
  else if(x>200 && y<10 && z>200)
       BOJA(255,0,255);
  else if(x<10 && y>200 && z>200)
       BOJA(0,255,255);
  else if(x>200 && y>200 && z<200)
       BOJA(255,255,255);
}
/*
*   function BOJA(color)
*/
void BOJA(int R_RED, int G_GREEN, int B_BLUE)
{
  analogWrite(R, R_RED);
  analogWrite(G, G_GREEN);
  analogWrite(B, B_BLUE);
}

Credits

Internet troll face explorer omrokhszvk
matejadjukic03
1 project • 2 followers
I am a cool
Contact
Logokocka lzxtgjyylt
MakerRobotics
6 projects • 75 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog