Home Forums Crumble Support Change sparkle/LED brightness?

This topic contains 1 reply, has 2 voices, and was last updated by  Daniel 1 month, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5408

    GHesse
    Participant

    Hi

    Probably a very simple question, but is it possible to change the brightness of a LED or sparkle using the crumble code?

    I was looking at the challenges in this document
    https://community.computingatschool.org.uk/files/7059/original.pdf

    One was

    Use an analogue dial crumb as a dimmer switch for a sparkle. You can use a variable to see the input from the dial crumb change when you turn the dial.

    But what I have been unable to determine is how you can then use the analogue input from the slider to control the sparkle brightness.

    Thanks

    #5412

    Daniel
    Moderator

    Hi GHesse,

    It is possible to programmatically adjust the brightness of the Sparkles using a potentiometer.

    I have included an image with two examples of code on. The top section of code will allow you to adjust the brightness of white, whereas the bottom section shows you how to adjust the brightness with a particular ‘shade’ of colour (e.g. purple). The wait statement helps to eliminate any flicker, but it may not be necessary in your case.

    I hope this helps, and if you have any more questions, feel free to ask.

    Dan

    Attachments:
    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.