Our younger child’s school is having a competition to design and make a crown for their Coronation celebrations on Friday. We think we can definitely add some wow-factor with the Crumble and a Sparkle matrix display!
First question: can we make a recognisable design on a 5×5 grid? We tried a few different options on paper and decided on the “Union Jack” design in the centre, below:
Top secret advance news: Crumble designer, Joseph, is actually working on a custom block to program the Sparkle matrix (similar to the block that already exists for the Sparkle baton) but, until this is ready for release, we will have to use our programming skills.
One way to write the program is block-by-block:
but this quite time consuming and boring to write. It also takes up a considerable amount of Crumble memory – especially if we then want to add in some animation.
In order to construct the design programmatically, we need to break it down into its separate elements. We started with the white background (“set all Sparkles to white”). We then created the St George’s Cross (the red vertical & horizontal bands) with a couple of “do-loops”:
St Andrew’s Cross (the blue diagonals) required a bit more thought. We initially used just one variable for the Sparkle number (because it is reset at the start of every do-loop) but to make the algorithms a bit clearer and to help us remember what the program does if we come back to it at a later date, we changed to two variables and gave them more meaningful names:
We can now add in some “wait” statements so the crosses appear in turn and put the whole program in a “do forever” loop to animate the design:
Notice that this takes up less space in the Crumble’s memory than the original program that set each Sparkle individually, once. It also makes it much easier to tweak the design. Do you think it should cycle faster or slower? Would you give St Andrew precedence over St George? (Apologies to St Patrick: we couldn’t see a way to include the red diagonals with only 25 pixels.)
As always, we’d love to see your own designs!