Forum.

 

Need help or have a question? Join the conversation in our community topics and share your ideas, tips, or challenges—we’d love to hear from you! Before posting, be sure to check our

 

?

Brightness setting ...
 
Notifications
Clear all

[Solved] Brightness setting does not work

7 Posts
2 Users
1 Reactions
5,033 Views
(@tibors11)
Eminent Member
Joined: 2 years ago
Posts: 11
Topic starter  

I tried to change the brightness for both the color light and the ultrasoni sensor's LEDs, but regardless what value I set, the LEDs remain at the same brightness. Even if I set to zero, they are fully bright.

I tried to set the original color with both the direct color selection block and the RGB selector. If I use the RGB selector, set only one channel (e.g. blue), and I set different blue values between 0-255, the brightness actually changes, e.g. zero will turn off the LED, 255 will set it to very bright blue, in-between it will be dimmed blue.

Do you think it is a bug, or brightness setting does not actually work for these components?



   
Quote
Camilo
(@cparrapa)
Developer Admin
Joined: 3 years ago
Posts: 112
 

Hi @tibors11

Where are you placing the brightness block? This block needs to be put at the beginning of the code, since it needs to setup that variable from the beginning, but now that you mentioned we can adjust that to work no matter where is placed in the blocks, in the preview code it will be always on top.



   
ReplyQuote
(@tibors11)
Eminent Member
Joined: 2 years ago
Posts: 11
Topic starter  

@cparrapa Ahh, I see, thanks!
Actually I always put as the second block minimum, because I thought I have to turn on some LEDs before it can work.

Does it mean that I cannot dynamically change brightness during the program run, e.g. to create a fade-in, fade-out effect, but I can set the brightness once, and the LEDs will always lit with that value?



   
ReplyQuote
Camilo
(@cparrapa)
Developer Admin
Joined: 3 years ago
Posts: 112
 

@tibors11 

Sorry I was wrong, it does not require to be on top but it needs another block that turns on the lights after to show the result. You can do fade in effects too, it is a value that can be updated along the code. Like in my attached example. (I am checking if maybe is certain blocks that do not have the brightness variable in the libraries) 



   
ReplyQuote
(@tibors11)
Eminent Member
Joined: 2 years ago
Posts: 11
Topic starter  

@cparrapa Wohohooooh, thank you! When I get home, I will try it immediately. :) I planned a mega programming day for my kids, and one of my examples to program is the brightness change.
Thanks again for the explanation!



   
ReplyQuote
Camilo
(@cparrapa)
Developer Admin
Joined: 3 years ago
Posts: 112
 

@tibors11 I just tested all color related blocks for both ultrasonic and ring and except for effects blocks in ring, they can all change brightness along the code as in my example code.

Take into account this is a parameter for the entire component meaning that you can not set individual brightness per LED (unless you set manually 0-255 values accordingly) at least with current blocks that is something that can be done easier in micropython if you want to explore.

Another fun example for you to play together is to use the ultrasonic sense input to change the brightness, attached example 😉  

Happy to help!



   
ReplyQuote
(@tibors11)
Eminent Member
Joined: 2 years ago
Posts: 11
Topic starter  

@cparrapa Thanks for the good news! I understand the limitations, but it is fine, it would be complicated anyway to change brightness for each LED individually. (And not so useful...) But it is a good way to teach programming, to show what you can achieve with pre-made libraries and how can you improve it with your own code additions.

And a huge thanks for the example program, it is very useful, I am sure I will work on it with the kids. :)



   
Camilo reacted
ReplyQuote
Scroll to Top
This will be available with the release of this product.