Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Arnov Sharma
Published © MIT

Color Mixer Box

A simple RGB Color Mixer for photography use, its powered by an Arduino Nano and uses three pots for controlling the colors.

BeginnerFull instructions provided2 hours450
Color Mixer Box

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Custom parts and enclosures

circuit holder

Schematics

sch

Code

code

C/C++
#include <Adafruit_NeoPixel.h>
#define NEOPIXELS 64
#define LEDsPin 9   

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR   0x3C

Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);

const int redPotPin = A0;      
const int greenPotPin = A1;   
const int bluePotPin = A2;  

int redValue = 0; 
int greenValue = 0; 
int blueValue = 0; 

int redPotValue = 0; 
int greenPotValue = 0; 
int bluePotValue = 0; 



Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXELS, LEDsPin, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(LEDsPin, OUTPUT);
  pinMode(redPotPin, INPUT);
  pinMode(greenPotPin, INPUT);
  pinMode(bluePotPin, INPUT);
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();  
  Serial.begin(9600);

}
void loop() {
  display.clearDisplay();
  
  redPotValue = analogRead(redPotPin);
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("RED=");
  display.setCursor(50, 0);
  display.println(redPotValue);


//  Serial.println("RED=");
//  Serial.println(redPotValue); 

  
  greenPotValue = analogRead(greenPotPin);
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 20);
  display.println("GREEN=");
  display.setCursor(50, 20);
  display.println(greenPotValue);

//  Serial.println("GREEN=");
//  Serial.println(greenPotValue);    
 
  
  bluePotValue = analogRead(bluePotPin);
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 43);
  display.println("BLUE=");
  display.setCursor(50, 43);
  display.println(bluePotValue);
  display.display();

  
//  Serial.println("BLUE=");
//  Serial.println(bluePotValue);   
  delay(50);
 
  redValue = map(redPotValue, 0, 1023, 0, 255);
  greenValue = map(greenPotValue, 0, 1023, 0, 255);
  blueValue = map(bluePotValue, 0, 1023, 0, 255);;
 
   for (int i = 0; i < NEOPIXELS; i++) {
    
    pixels.setPixelColor(i, pixels.Color(redValue, greenValue, blueValue));
    pixels.show(); 
    delay(50); 
  }
}

Credits

Arnov Sharma
310 projects • 311 followers
Just your average MAKER

Comments