- This topic has 1 reply, 2 voices, and was last updated 6 years, 2 months ago by
Daniel.
-
AuthorPosts
-
October 10, 2017 at 4:28 am #5408
GHesse
ParticipantHi
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.pdfOne 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
October 10, 2017 at 11:41 am #5412Daniel
ModeratorHi 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:
-
AuthorPosts
- You must be logged in to reply to this topic.