When writing programs for Colour Tails and GlowBugs, it is useful to see what your program will do before you load it onto your CodeBug. You can do this with the emulator. To add your GlowBugs to the emulator, follow these steps:
Click on the cog at the top right of CodeBug.
Under the Connected Hardware title, tick the CodeBug Colour Tail box.
Tick the check-circle for GlowBugs x 5.
Click Apply button.
To control the LEDs on Colour Tail you need to use the blocks from the Colour Tail menu.
Click the Colour Tail menu.
Drag in a set colour tail pixel to colour block and snap it to the start block.
Set the colour by clicking on the coloured square on the block and pick the colour you want from the window that appears.
Click the Play button to run your code. The LED 0 on the GlowBugs emulator image will change to the colour you set.
To flash the LED we need to turn it on and off, with a pause in between.
From the Basics menu drag in a pause block and snap it beneath your set colour tail pixel to colour block.
From the Colour Tail menu drag in another set colour tail pixel to colour block and snap it beneath your pause block. Set this new block to a different colour.
Click the Play button to run your code. Notice that LED 0 changes colour.
To flash your LED more than once, you need to replay or ‘loop’ your code.
From the Loops menu, drag in a repeat while true block and place it on a blank area on your workspace.
Click on your first set colour tail pixel to colour block and drag your blocks into your new while loop.
Snap your while loop onto the start block.
From the Basics menu, snap in another pause block below your second set colour tail pixel to colour block (making sure it is inside the repeat while block).
Click the Play button to run your code. LED 0 on the GlowBugs emulator will change colour continuously.
Click the Download button to download your program. Make sure to follow the download to CodeBug tutorial to load your program onto your bug.