I followed the tutorial which found by clicking on Learn, then tutorial and scrolling down...  direct link here: http://www.codebug.org.uk/learn/activity/54/fruit-keyboard/

 

The tutorial leads you through the main steps, with descriptions and explanations.

 

It will take you to the create page in tutorial mode - the steps to take are described in the box at the left.

As you step through this pop up instructions appear showing you exactly what to click on in order to create the code.

 

Following the steps to create one input was straightforward and it was easy enough to repeat the steps to extend it from one to four inputs.

Took me around 10 minutes.

 

I saved my code and it can be viewed here: http://www.codebug.org.uk/explore/codebug/1322/ (You can use REMIX to edit a copy).

 

I downloaded the code file and followed the instructions to load it.

(Removed the battery from the bug, Plug in the USB while holding button 1, then right clicked the file and selected send to codebug).

 

I did not have any crocodile clips, so simply twisted wires to the codebug and pushed the other ends into the fruit.

Re-inserted the battery and it worked.

 

I found I did not need to touch the ground wire, just the fruit.  I suspect this is down to background mains being picked up.

In fact, touching the ground wire caused it to detect the bananas!

I had used a bunch of 5 bananas, so I came up with the theory that size mattered.

I swapped the wires between the strawberry and the bunch of bananas and touching the earth wire now triggered the input connected to the bananas. (It displayed strawberry).

 

My daughter also tried touching the fruit and it did not trigger, but if I touched her, while she was touching the fruit, then it did!

 

This suggests some experiments could be made to see under which circumstances a connection to ground is needed and whether the environment affects triggering.

Fruit Keyboard

Doing this project I found out some of the features / rules for using the codebug, e.g. that inputs that you intend to use need to be declared in the start block.
(Something you have to do with most micro-controllers).

 

Working through the tutorials is good way to learn about programming the codebug.