codeBuglogo.pngIntroducing CodeBug!

  What is CodeBug

  10 CodeBug Projects in 10 Days

  Are You a STEM Educator?

 



We start the project by visiting the CodeBug website http://www.codebug.co.uk and creating an cd3.png

account. It only takes a few minutes. While logged in, clock on Create to start a new project. Don't forget to save your work!

 

The interface for CodeBug contains an area to the right of the screen with is the primary programming interface. There are a series of menus that are used to store the blocks with can be dragged from the menus into the coding area. Good blocks are made to connect together, and that is what we intend to do!


Now that you have familiarized yourself with the interface, let's get started on an intermediate project Thomas Macpherson-Pope pulled together from CodeBug.org.uk

 


What you need:

CodeBugCodeBug

Micro USB CableMicro USB Cable

CR2032 BatteryCR2032 Battery

Computer

Card


The Project


CodeBug can scroll messages so you can create a fun personalized card, that can be adapted for different occasions.To tell CodeBug what to do, you need to give it a list of simple instructions. This list of instructions is known as a program. You can use this website to create programs and you will be able to see them in action before downloading them and programming CodeBug. CodeBug’s LED grid can display letters. If we move these letters from one side of the grid to the other, we can have another letter moving in after it.

Let's start coding the Display and we begin at...well the start which is a pre-existing block in which the coding is  ready to be built on! The Start block can be used to configure CodeBug when we run the emulation on the interface, for this project we will keep it as is.

 

For this block of code we are going to select the Scroll Sprite block from the Sprite Menu and connect it to the Start Block. This block will scroll the content to the left of the LED matrix. Since we will need something to scroll, let's also go ahead and use the Get String Sprite, also found on the Sprite Menu, and connect it to the Scroll Sprite block. The default text for the Scroll Sprite block is "Hello World", which we have replaced with "Have a Great Day!". Within the Scroll Sprite block you can change the rate of which the letter will scroll (we have is set at the default 100ms) or the direction of the scroll ( left,right,up, down).

 

At this point the program will scroll the "Happy Birthday!" message, but only once. For the purposes of this project we will need it to scroll repeatedly. Let's add a Repeat While True block to repeat (loop) the blocks inside it. From the Loops menu drag in the Repeat While True block into an empty area on the Workplace. Next we will drag the Scroll Sprite block into the body of the Repeat While True block so your code will repeat continuously. We'll drag that While Loop and its block onto the Start block.We don't want the CodeBug to start until a button is pressed so from the Basics menu, we'll select Sleep Until Button Changes above the Repeat While True block. 

 

cb3.png

 

From there you can run an emulator to see how the program would look on the CodeBug...

 

 



With the code working, click on Download, it's just under the simulator controls. When the code downloads, plug in a USB to micro USB into your computer. While holding Button A of your CodeBug also insert the micro USB to the CodeBug. The top left LED in the matrix on the CodeBug will flash. Your computer should also recognize the CodeBug as a USB drive on your computer. Copy the code downloaded from the CodeBug website to the USB drive and run the program by pressing Button B.


CodeBug can be powered by battery so you can take it wherever you want! To power CodeBug by battery, first unplug the Micro-USB cable, do not worry as CodeBug will remember your program without being plugged in. Now slide in a coin battery (CR2032) with the positive (plus symbol) side up. Your program will begin running again!

 

To make your card, download the attached template.and print it out. Lightly tack the template to some coloured card with some sellotape and draw along the lines of the template, to indent the shapes into the card below. Remove the template and cut out the shapes on the card.

Now insert CodeBug’s buttons into the two little squares in the card, from the inside of the card. Put some sellotape on the back of CodeBug to fix it to the card.

Your card is finished! Grab some pens and decorate your new interactive card. You could even try cutting out the Great Day message and stick different colored card behind each letter.

REMIX THIS PROJECT


See more CodeBug projects and learn how you can get one of your own by visiting: 10 CodeBug Projects in 10 Days