Wearables Guide


CodeBug’s legs can be easily sewn to fabric. If you use conductive thread, you can connect sewable LEDs and buttons to the legs and use them in your programs.

You will need
CodeBug CodeBug
Micro USB cable
CR2032 battery
Conductive thread
Sewable buttons
Sewable LEDs

Sewable LED

CodeBug’s legs can be used to turn LEDs on and off. In this mode the legs are called outputs.

  • Thread your needle (get an adult to help you).

  • Tie a knot in at the other end.

  • Place your CodeBug on your fabric, face up.

  • Pierce the fabric with the needle from the underside of the fabric, up through the PWR leg then down through the fabric on the other side of the leg.

  • Repeat this 5 times so your thread has a good connection with the leg and making sure it will hold CodeBug in place.

  • Sew up and down through the fabric until you reach the position where you want your LED to go.

Sew the positive side of the LED (with the plus symbol) to the PWR leg on CodeBug. Then sew the negative end of the LED (with the minus symbol) to leg 0.

You may wish to sew the legs on the opposite side of CodeBug as well to make sure it is held to your fabric.

Control your LED

Now that your LED is all sewn up and connected to CodeBug, you can write a program to flash it on and off.

Follow the tutorial below to create your program.

Sewable Button

CodeBug’s legs are very sensitive, they can feel electricity passing through them. In this mode CodeBug’s legs are called inputs.

Buttons and switches work by controlling whether two contacts are connected or not. When the button is pushed, or the switch flicked on, the two sides are connected and electricity can flow, but in the off state no electricity will flow.

Sew your buttons in the same way you sewed the LEDs. Sew one ring of the button to the GND leg on CodeBug and the other ring to the leg 1 on CodeBug.

Using your button

With your button sewn to the fabric, you can make programs that have user interaction.

Follow the tutorial below to create your program.

What next?

Add more sewable LEDs and buttons to your project and try make a game! Share pictures of your project with everyone.

Back to top