In my function:
const float EXPONENT = 1.8;
const uint8_t INDEX_MAX = 15;
uint8_t calcNewValue(uint8_t pwmIndex){
uint8_t pwmBaseValue = 255, result = 0;
result = pow(pwmIndex, EXPONENT) / pow(INDEX_MAX, EXPONENT) * (pwmBaseValue);
return result;
}
When having a pwmIndex of 15 the "result" should read as: (15^1.8) / (15^1.8) * 255 resulting in 255. But I get 254 instead. Why?
Update: I checked the code here and it should work but it somehow doesn't on my 8 bit microcontroller.