Hello, a short question.

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!

@Lars_Walpurgis ​, 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.

Thanks, that works great!!!

What type of 20W COB led?

@Robert_Atkins ​ 2 stücke 100% Wasserdichte COB Angle Eye 100 MM 20 Watt COB Licht Ringe DC-12V Weiß/warmes weiß/blau/Eis BlueAngle Eyes Scheinwerfer
http://s.aliexpress.com/BrayERFR
(from AliExpress Android)