Basic GE Color Effe...
 
Notifications
Clear all

Basic GE Color Effects Controller

10 Posts
5 Users
0 Reactions
5,213 Views
Posts: 157
(@ekuth)
Estimable Member
Joined: 17 years ago
bh758 wrote:I think you need to reread the ENTIRE question!

Thanks,
Brian

Honey gets better results than vinegar...


Reply
erm213
Posts: 479
(@erm213)
Honorable Member
Joined: 16 years ago

Out of curiousity, what are you planning on hooking up to the A0-A2 inputs that will do the 0-5V?

Erik


Reply
Posts: 2
(@ookid)
New Member
Joined: 15 years ago

Do you still need assistance? I know this is an 4 month old thread but the coding is relatively simple.


Reply
Posts: 7
Topic starter
(@bh758)
Active Member
Joined: 17 years ago

Yeah, no one really replied who was willing to do it....which kind of surprises me since the dmx for those who already have other setups can be $$ to get into......just was looking for another alternative for those of us in that boat.


Reply
Posts: 2
(@ookid)
New Member
Joined: 15 years ago

Here is some basic code for what you want to do plus some extra functions to do different things like only change one bulb's color. The coding is fairly straight forward but if you need help just ask. My code is almost totally based on neepawa's code from this, http://doityourselfchristmas.com/forums/showthread.php?13062-RGB-LED-s-Now-Consumer-Grade-Hackable , thread.

const int lightPin1 = 4; //pin to connect the data line to, don't  forget to disconnect the controller box and tie the microcontrollers ground to the lights ground wire
const int bulbCount = 50;       //look up deep darc for more information
const int defaultIntensity = 0xCC;
const int broadcastBulb = 63; //bulb to increase/ decrease intensity over entire strand



const int sensor1 = 14;
const int sensor2 = 15;
const int sensor3 = 16;

void setup()
{
  pinMode (sensor1, INPUT);
  pinMode (sensor2, INPUT);
  pinMode (sensor3, INPUT);
  pinMode(lightPin1, OUTPUT);
  digitalWrite(lightPin1, LOW);
  delay(1000);
  //Enumerate the bulbs
  fillString(bulbColor(0,0,0));

  fillString(bulbColor(0,15,0));
  delay(500);
}


void loop()
{
  int red = analogRead(14);
  int green = analogRead(15);
  int blue = analogRead(16);
  red = map (red, 0, 1023, 0, 15); // maps the 0-1023 value given to 1-15 light level for rgb leds
  green = map (green, 0, 1023, 0, 15);
  blue = map (blue, 0, 1023, 0, 15);
  fillString (bulbColor(red, green, blue));
}

/*
 * Signalling for the data line
 */

void writeStart() {
  digitalWrite(lightPin1, HIGH);
  delayMicroseconds(7);
}

void writeBit(int b)
{
  switch (b)
  {
  case 0:
    digitalWrite(lightPin1, LOW);
    delayMicroseconds(3);
    digitalWrite(lightPin1, HIGH);
    delayMicroseconds(17);
    break;

  case 1:
    digitalWrite(lightPin1, LOW);
    delayMicroseconds(17);
    digitalWrite(lightPin1, HIGH);
    delayMicroseconds(3);
    break;
  }
}

void writeStop()
{
  digitalWrite(lightPin1, LOW);
  delayMicroseconds(32);
}

/*
 * Functions to set an individual bulb
 */

int bulbColor(int r, int g, int b)
{
  return (r+(g<<4)+(b<<8));
}


void setBulb(int bulb, int intensity, int color)
{
  writeStart();

  for(int i=5; i>=0; i--)
    writeBit(bitRead(bulb, i));

  for(int i=7; i>=0; i--)
    writeBit(bitRead(intensity, i));

  for(int i=11; i>=0; i--)
    writeBit(bitRead(color, i));

  writeStop();
}


//If no inensity is specified, use the default
void setBulb(int bulb, int color)
{
  setBulb(bulb, defaultIntensity, color);
}

/*
 * Functions to set a series of bulbs or the entire string
 */


void fillBulbs(int start, int count, int intensity, int color)
{
  while(count--)
    setBulb(start++, intensity, color);
} 

//If intensity is not specified, use the default
void fillBulbs(int start, int count, int color)
{
  fillBulbs(start, count, defaultIntensity, color);
} 


//Fill the entire string
void fillString(int intensity, int color)
{
  fillBulbs(0, bulbCount, intensity, color);
} 


//Fill the entire string with the default intensity
void fillString(int color)
{
  fillBulbs(0, bulbCount, defaultIntensity, color);
}

Reply
Page 2 / 2
Share: