Potentiometer Pyramid

 

Description
 
3 pots used to control 3 LEDs (blue, green, and red), the ultimate color mixer, where the color shown on the pyramid diffuser is the product of controlling the specific LED/RGB brightness.
 
Components Used
 
3 10k Potentiometers
3 LEDs (Red, Green, Blue)
220 ohm resistors 
Pyramid diffuser 
 
Arduino Code
/*
* 3 pots act as controllers for brightness of LED with pyramid diffuser 
* modified version of 
* http://www.arduino.cc/en/Tutorial/AnalogInput
* and brightness controls of
* http://arduino.cc/en/Tutorial/Dimmer 
* by Andrea Hsieh September 20, 2011
*/
 
// Analog input (potentiometers)
 
int potBlue = A0;   
int potGreen = A1;   
int potRed = A2;   
 
// Digital pin (LEDs)
 
int ledBlue = 11;   // blue
int ledGreen = 10;   // green
int ledRed = 9;   // red
 
// Variable values
 
int valBlue = 0;      // variable to store the value coming from the sensor
int valRed = 0;      
int valGreen = 0;      
 
 
void setup() {
 
  pinMode(ledBlue, OUTPUT);
  pinMode(ledGreen, OUTPUT);
  pinMode(ledRed, OUTPUT);
  
}
 
void loop()
{
 
  valBlue = analogRead(potBlue);  // read input pins, convert to 0-255 scale
  valGreen = analogRead(potGreen); 
  valRed = analogRead(potRed) ;
 
  analogWrite(ledBlue, valBlue/4); // analogWrite can be between 0-255
  analogWrite(ledGreen, valGreen/4); // analogWrite can be between 0-255
  analogWrite(ledRed, valRed/4); // analogWrite can be between 0-255  
 
}
 
 
 
IMG_4798.jpg
IMG_4794.jpg
0
Your rating: None