Fruit Keyboard


CodeBug’s legs have magical properties. They can sense when something conductive is touching them, such as wire, people or even fruit! By connecting different pieces of fruit to CodeBug’s legs, you can get it to say which piece of fruit has been touched.

You will need
CodeBug CodeBug
Micro USB cable
CR2032 battery
OR Fruit

Writing the program

To turn CodeBug into a fruit keyboard, you must first write code that recognises inputs and then scrolls the name of the fruit. Click the link below to follow the simple tutorial to create your program.

Wire it up

Now you need to wire up a piece of fruit or veg.

  • Connect a croc-clip to the leg labeled GND.

  • Connect another croc-clip from leg 0 to a piece of fruit.

Note: If your CodeBug has gone to sleep, wake it up by pressing either button A or B.

Test your program by holding the croc-clip connected to ground (make sure you touch the metal part), while pressing the fruit repeatedly. You will see the text scroll as you touch the fruit.

Finishing your keyboard

Now you have made a simple fruit input, you can repeat the process by attaching more pieces of fruit with more croc-clips to CodeBug’s other numbered legs.

Extending your program

You need CodeBug to sense these other inputs and scroll the names of the fruit.

Click below to extend your fruit keyboard program.

What next?

Now you have created a fruit keyboard, think of fun things to do with it! Some ideas include using your fruit keyboard as a controller for a CodeBug game or making a fruit burglar alarm.

See what other objects are touch sensitive with CodeBug (hint: anything made of metal or water should work).

You may have noticed that some fruits only require a gentle touch, whereas some need to be squeezed for CodeBug to respond. Try to perform experiments by gathering a wide range of different fruits and test them to see which are very conductive. There could be all sorts of reasons one fruit may conduct better than others, such as the amount of water it contains or the hardness of the skin. Share your results and conclusions, we’d love to hear what you think.

Back to top