Monday, April 12, 2010

Control Box

To test different background patterns for the wall, I wanted to build a sort of control box. I bought a variety of potentiometers- slides and knobs a while back and I can put them to use. so I designed a box and got it laser cut.

Amazingly everything fit the first time.

Inside there is breadboard to hold all of the fixed items as well as arduino.
I wrote a test program for each of the different elements-lcd, knobs, slides and buttons.
Button test

Slider Test

Here is the code to test the sliders

#include <LiquidCrystal.h>

const byte redSliderPin = 0;
const byte greenSliderPin = 1;
const byte blueSliderPin = 2;
const byte whiteSliderPin = 3;

// Init our Input Vars
byte redSlider;
byte greenSlider;
byte blueSlider;
byte whiteSlider;

// initialize the library with the numbers of the interface pins]
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);

void loop() {

redSlider = analogRead(redSliderPin)/4;
greenSlider = analogRead(greenSliderPin)/4;
blueSlider = analogRead(blueSliderPin)/4;
whiteSlider = analogRead(whiteSliderPin)/4;

// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
lcd.print("R: ");
lcd.print(' ',BYTE);

lcd.setCursor(8, 0);
lcd.print("G: ");
lcd.print(' ',BYTE);

lcd.setCursor(0, 1);
lcd.print("B: ");
lcd.print(' ',BYTE);

lcd.setCursor(8, 1);
lcd.print("W: ");
lcd.print(' ',BYTE);

No comments:

Post a Comment