Luminosity Widget - Adjusting Brightness

Hello!
Today is the first day I learn Cayenne and I add Luminosity project for instructions. I add a slider range of changes from 0 to 1023 as in the example.
However, when I begin to move the slider, the led immediately lights up to maximum brightness. Slider stands in the meaning of 8 (of 1023) and the output is already 4.7 V

A few minutes later I realized that the minimum value of brightness slider in 1023!
Write about it in the manual.

need a change this line in the scetch

analogWrite(LED_DIGITAL_PIN, 255 - currentValue / 4); // must be from 0 to 255

I also faced same issue try to add smaller steps while adding widget

1 Like

You can try using this line:

currentValue = map(currentValue, 0, 1024, 0, 256);

This will transform range from 0 - 1023 to 0-256. You can also reverse value:

currentValue = 255 - map(currentValue, 0, 1024, 0, 256);

https://www.arduino.cc/en/Reference/Map

3 Likes

HI @scratch.book,

Sorry for the late reply here, but thank you for posting this! We actually found some issue with our slider widget, which we will be fixing soon. I think this will be included. Either way, thank you for posting how you resolved the issue you were experiencing, now others can hopefully follow along :slight_smile:

-B