Hello, a short question. I have a 20w cob led and i want to control them via a rotary encoder with procent values 0-100. At the moment i use a teensy 3.2 with 12 bit pwm with a linear mapping. But the eye perception is nearly logarithmic not linear and i would like to change this. But how do i do this in the best way? Is there a function in fast led to map the 0-100 value to the 0-4095 pwm value logarithmic? Thanks for your help!
no plus ones
- , I had this in my notes, does this help any?
//for linear potentiometer returning 0-1024 range.
float num = analogRead(potPin);
num = pow((num/1024.0), 2.2);
uint8_t value = num * 255;
Adjust the 2.2 power factor by a tiny bit to change the curve as desired.34w
- Thanks, that works great!!!34w
- What type of 20W COB led?34w
aliexpress.com - 2pcs 100% Waterproof COB Angle Eye 100MM 20W COB Light Rings DC-12V White /warm white / blue / Ice BlueAngle Eyes Headlight
(from AliExpress Android)34w