Go Down

Topic: Hue-controllable RGB LED lamp (Read 23 times) previous topic - next topic

Wiley Wiggins

I'm trying to do something similar, but instead of a pot, I'm using three Ping))) ultrasonic rangefinders to control fade my LED's. I'm trying to use that map command to get the distance data turned into 0-255 values. Haven't quite got it yet...

Venkat Reddy

I have used your code and get the colors to adjust based on a potentiometer input. There is one thing I observed I do not seem to see any blues. I see green, pinks, reds yellow but do not get a good blue. Any ideas why this seems to be the case.


excellent algorithm :))) i think is good when read 0 from pot to put all colors off /switch off/ and if the pot value is max 1023 to fire all the leds /white/ this will cover this missing part  ::)


ONe can also do the RGB LED control using a mouse x and y position feed from Processing, I think Its the Firmata libary , It efectively changes the Rduino platform inti a data IO device over serial, This is plent useful for pc based control


When you output an PWM value between 0 and 255, it's not even remotely similar to the same RGB value.  The problem is that the LED brightness does not climb linearly with the PWM duty cycle.  If you go from 1 to 2, there's a huge jump in brightness while if you go from 100 to 200 there's almost no discernable change.  Quite often just to save power, I'll PWM my LEDs at about 20% duty cycle and it looks almost the same as full brightness.  I've been considering a similar project for a while but because this issue I was looking at only having 10 possible brightness levels for each colour and then using empirical observation to convert those values to PWM levels.

Also, as far as your map function...Why aren't you just using
Code: [Select]

r = 255 - r;
g = 255 - g;
b = 255 - b;

Go Up