When writing programs for Colour Tails, it is useful to see what your program will look like, using the emulator. You can add your Star Colour Tail to the emulator in a few steps:
Click on the cog at the top right of CodeBug.
Under the Connected Hardware title, tick the CodeBug Colour Tail box.
Tick the checkbox for the Star.
Click Apply button.
To control the LEDs on your Colour Star you need to use the blocks from the Colour Tail menu.
Click the Colour Tail menu.
Drag in a set colour pixel to colour block and snap it to the start block.
Set the colour by clicking on the coloured square and pick the colour you want from the window that appears.
Click the Play button to run your code. The LED 0 on the Star emulator image will change to the colour you set.
To cycle a pattern on your Colour Star, you need to change the colour of each LED in sequence.
From the Loops menu, drag in a count with block and snap it to your start block.
Drag your set colour pixel to colour block into your count with block.
From the Basics menu, drag in a pause block and snap it beneath your set colour pixel to colour block (making sure it is inside your count with block.
Drag the 0 block, from inside your set colour pixel to colour block, into the bin.
From the Variables menu, drag in the i block, and snap it into the new gap in your set colour pixel to colour block.
Click on the second number block (after the text ‘to’) of your count with block and set it to 8 (as the Colour Star has 9 LEDs and the count starts from 0).
Click the Play button to run your code. The LEDs on the Star emulator will change colour one by one.
To create a repeating pattern you will need to change the LEDs between two colours.
Right-click your count with block and click Duplicate and snap this copy below your original count with block.
Click on the colour of your second colour pixel to colour block and change it to a different colour.
From the Loops menu drag in a repeat while true block and snap it to your start block.
Drag the rest of your code into this repeat while true block.
Click on the your pause blocks and change them to 200.
Click the Play button to run your code to watch your repeating pattern continuously change.
Click the Download button to download your program, then follow the instructions to load it onto your bug.