Jump to content

Question about KH 213 Arduino controlled lighting


G+_Tyler Pearson
 Share

Recommended Posts

Question about KH 213 Arduino controlled lighting. I get the point about setting the map to 70 instead of 0 but what was the reason for making it 850 instead of 325/580/835 since they would be multiples of 255. Just trying to figure out why those values were chosen.

 

Also is that supposed to read "This maps the value of the pot from 0-1020 to a value between 0-255"

Instead of 0-5? If not this is also a bit confusing.

 

 

int RedValue = map(RedPot, 70, 850, 0, 255); // This maps the value of the pot from 0-1020 to a value between 0-5

Link to comment
Share on other sites

The values between 70 and 835 were coming from the variable resister. Hence using 325 would limit you to under half the range of turning the resisters making precision control of balance/brightness by the user harder.

It doesn't matter if it's an exact multiple of 256 as analog noise will always cause it to fluctuate.

Link to comment
Share on other sites

Robert Gauld Ya i figured it would be harder to control since it does fluctuate as i seen in the video. So since the Pot has a possible 0-1020 value but you take a few off the top and bottom to be safe it could be say 50-900 as well or 100-800 but it would be less precise as you make them value smaller. Does that mean that the way it maps the 70-850 to a value of 0-255 for the led control by percentage? So if you turned the Pot 20% giving a Pot value of 156 it would convert that to 20% of 256 about 51 on the color scale. +/- a little since its not 100% precise.

Link to comment
Share on other sites

 Share

×
×
  • Create New...