Introduction
Learn how to use the Sparkle module by creating some starting lights for a race around the planet.
-
-
Sparkles are very useful - they are LEDs, just like the red/green LED from before, but much cleverer!
-
They have small chips inside them, which allow you to control many LEDs using just one output. If you look really closely you might be able to see them.
-
They are also three LEDs in one - there is a red, green and blue LED in every sparkle.
-
We can control these three internal LEDs separately, and mix them together to create any colour!
-
-
-
Build up your robot like the picture.
-
Sparkles must always be plugged into output D - this is very important as otherwise they won't work!
-
-
-
All the blocks we need for sparkles are in the sparkles menu. Click on it and have a look at all the new blocks you can use.
-
For now, let's test the sparkles by building the simple program in the picture - hopefully they all turn red when you program your robot!
-
Don't stare at the sparkle board for too long - it's very bright!
-
-
-
It's really easy to control the red, green and blue LEDs separately to make any colour we like.
-
Click on the red square to bring up the colour picker - try a few different ones and see how they look!
-
Switch off your junior main board between programs to save battery life!
-
-
-
Remember, we can also control each sparkle individually!
-
We can use the set sparkle 0 block to change just one sparkle's colour
-
In programming numbers start from 0, not 1 - so for three sparkles, the first is 0, the second is 1 and the third is sparkle 2.
-
Use three of the individual sparkle set blocks to set each of your first three sparkles to a different colour.
-
-
-
Let's make a set of starting lights for a race across the planet surface.
-
Check out the F1 starting lights in the video - can you put together a program using sparkle and wait blocks to make your own?
-
The lights should turn red 3 at a time, then all go green at the same time.
-