# Adventure Time Coffee Cup Lamp with MakeCode

## Overview

https://youtu.be/_MYBPCrsNag

In this project we’ll show you how to build a coffee cup lamp using an Adafruit Circuit Playground Express and Microsoft Makecode.

&nbsp;

We'll design our lamp out of a paper&nbsp;cup and use capacitive touch to change the colors of the LEDs!

&nbsp;

You can build your own capacitive touch pads using conductive tape.

&nbsp;

So get ready to go on an adventure and learn how to craft your own paper cup lamp!

![circuit_playground_color-touch.gif](https://cdn-learn.adafruit.com/assets/assets/000/068/101/medium640thumb/circuit_playground_color-touch.jpg?1545844638)

Program your Circuit Playground Express using code blocks in Microsoft Makecode.

&nbsp;

Drag and drop to create interactive lights that change colors by using the sensors and inputs on-board the circuit playground.

&nbsp;

Get inspired to make paper crafts of your favorite characters and build a scene straight out the tree fort!

![circuit_playground_hero-hold.gif](https://cdn-learn.adafruit.com/assets/assets/000/068/102/medium640thumb/circuit_playground_hero-hold.jpg?1545845084)

![](https://cdn-learn.adafruit.com/assets/assets/000/068/151/medium800thumb/circuit_playground_hero-thumb.jpg?1545872972)

## Prerequisite Guides

&nbsp;

There's resources in these guides that go beyond what's covered in this tutorial. MakeCode guide is all about setting up your Circuit Playground Express board.

&nbsp;

TheCircuit Playground Express introduction guide walks you through all of the pinouts, sensors and everything you need to know.

&nbsp;

- [MakeCode for Circuit Playground Express](https://learn.adafruit.com/makecode)
- [Introducing Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express)

![circuit_playground_parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/106/medium640/circuit_playground_parts.jpg?1545847032)

![circuit_playground_art-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/107/medium640/circuit_playground_art-parts.jpg?1545847098)

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
![A Black woman's manicured hand holds a round microcontroller with lit up LEDs.](https://cdn-shop.adafruit.com/640x480/3333-05.jpg)

### 3 x AAA Battery Holder with On/Off Switch and 2-Pin JST

[3 x AAA Battery Holder with On/Off Switch and 2-Pin JST](https://www.adafruit.com/product/727)
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries and have an on-off switch. That makes...

In Stock
[Buy Now](https://www.adafruit.com/product/727)
[Related Guides to the Product](https://learn.adafruit.com/products/727/guides)
![Front angled shot of 3 x AAA battery holder with on-off switch and 2-pin JST PH connector.](https://cdn-shop.adafruit.com/640x480/727-07.jpg)

You'll need conductive tape, you can use either copper foil or conductive nylon tape:

### Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll

[Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll](https://www.adafruit.com/product/1128)
Copper tape can be an interesting addition to your toolbox. The tape itself is made of thin pure copper so its extremely flexible and can take on nearly any shape. You can easily solder to it, and the tape itself can carry current just like a wire. On the back is an electrically conductive...

In Stock
[Buy Now](https://www.adafruit.com/product/1128)
[Related Guides to the Product](https://learn.adafruit.com/products/1128/guides)
![Angled Shot of the Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll.](https://cdn-shop.adafruit.com/640x480/1128-04.jpg)

 **OR**

### Conductive Nylon Fabric Tape - 5mm Wide x 10 meters long

[Conductive Nylon Fabric Tape - 5mm Wide x 10 meters long](https://www.adafruit.com/product/3961)
With our fun assortment of&nbsp;[conductive materials](https://www.adafruit.com/category/190),&nbsp;[cosplay](https://www.adafruit.com/index.php?main_page=category&cPath=290)&nbsp;and&nbsp;[wearables](https://www.adafruit.com/category/65)&nbsp;have never...

In Stock
[Buy Now](https://www.adafruit.com/product/3961)
[Related Guides to the Product](https://learn.adafruit.com/products/3961/guides)
![Conductive Nylon Fabric Tape - 5mm Wide](https://cdn-shop.adafruit.com/640x480/3961-00.jpg)

### Part: Foam Tape
quantity: 1
Foam Tape

### Part: Paper Coffee Cup with Lid (12oz)
quantity: 1
Paper Coffee Cup with Lid (12oz)

### Part: Scissors 
quantity: 1
Scissors

![](https://cdn-learn.adafruit.com/assets/assets/000/068/108/medium800thumb/circuit_playground_cpx-touch.jpg?1545847959)

# Adventure Time Coffee Cup Lamp with MakeCode

## Code

## MakeCode for Circuit Playground Express

MakeCode is this programming editor that runs in the Google Chrome web browser. It’s has an intuitive interface that’s both block based and text editor.

It works with Adafruit's Circuit Playground Express so you can make interactive projects with the on-board sensors and components. You can drag & drop blocks to make interactive programs using lights and sounds without having to solder or learning a new syntax.

You can alternatively upload code directly to the Circuit Playground Express with WebUSB,&nbsp;[see the steps to do so here](https://learn.adafruit.com/makecode/webusb).

## Setup Circuit Playground Express for MakeCode

To get started, we'll need to head over to the&nbsp;[Adafruit MakeCode](https://makecode.adafruit.com/beta?webusb=1#editor)&nbsp;website and follow the steps below.

1. Plug in your Circuit Playground Express with a&nbsp; **USB Cable**
2. Press the&nbsp; **RESET** &nbsp;button. Green light means you're ready to MakeCode
3. Download the&nbsp; **UF2** &nbsp;file and drop it onto&nbsp; **CPLAYBOOT**.

[Edit in Makecode](https://makecode.com/_XU77tb4HcLou)
## Upload and Test Code

&nbsp;

Once you have your CPX setup with the MakeCode UF2, try testing it out by uploading the code to the board.

&nbsp;

Click the link below to open up the program in MakeCode. Click on the pink edit icon near the top of the title to open the code.

&nbsp;

This will create a project in MakeCode and allow you to edit, modify and upload the code to the board.

![circuit_playground_makecode.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/103/medium640/circuit_playground_makecode.jpg?1545845340)

# Adventure Time Coffee Cup Lamp with MakeCode

## Circuit Diagram

![](https://cdn-learn.adafruit.com/assets/assets/000/068/105/medium800/circuit_playground_circuit-diagram.jpg?1545846149)

## Circuit&nbsp;Diagram

This provides a visual reference for wiring of the components. They aren't true to scale, just meant to be used as reference.

## Power Pack

The 3xAAA battery pack can supply ~4.5V which is suffice to power the Circuit Playground Express. The battery plugs directs into the JST connector. You can also power from USB if you don't mind plugging it into a computer or wall adapter

## Copper Tape

We'll use copper tape to extend the touch pads to the outside of the cup.&nbsp;The following connections are setup for the program in MakeCode.

- The pads marked **A4** , **A5** and **A6** can connect to the copper tape

# Adventure Time Coffee Cup Lamp with MakeCode

## Assemble

## Cut out Frame

&nbsp;

First we'll print out our design files for the cup frame and our characters. We'll use the bigger trapezoid for our background.

&nbsp;

We'll use the smaller&nbsp;trapezoid to trace an out line our coffee cup and then cut that out to create the framing on the cup.&nbsp;

&nbsp;

Now we'll secure the bigger trapezoid cutout to the inside of the cup with&nbsp;two small pieces of tape. Adhere the tape to the top area as shown.

&nbsp;

The tree fort foreground will slide between the cup and the trapezoid piece.

&nbsp;

&nbsp;

![circuit_playground_cup-part.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/109/medium640/circuit_playground_cup-part.jpg?1545848135)

![circuit_playground_cup-draw-frame.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/123/medium640/circuit_playground_cup-draw-frame.jpg?1545855560)

![circuit_playground_cup-frame-cut.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/126/medium640/circuit_playground_cup-frame-cut.jpg?1545855773)

![circuit_playground_cup-window-tape.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/127/medium640/circuit_playground_cup-window-tape.jpg?1545855802)

[Download-Cut-Out-Template.svg](https://cdn-learn.adafruit.com/assets/assets/000/068/860/original/Download-Cut-Out-Template.svg?1546916683)
## Cut out design

&nbsp;

Use scissors to cut out the characters to use in our scene! We can fit about three characters on a standard 12oz cup.&nbsp;

&nbsp;

We can also use a vinyl cutter to help cut out finer details in characters and scenes. The svg file includes silhouettes for each cutout print.&nbsp; &nbsp;

&nbsp;

![circuit_playground_papercut.gif](https://cdn-learn.adafruit.com/assets/assets/000/068/111/medium640thumb/circuit_playground_papercut.jpg?1545852102)

![circuit_playground_cup-window-attach.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/128/medium640/circuit_playground_cup-window-attach.jpg?1545855846)

[Adaventure-Time-Characters.zip](https://cdn-learn.adafruit.com/assets/assets/000/068/861/original/Adaventure-Time-Characters.zip?1546916746)
[External-Treehouse.svg](https://cdn-learn.adafruit.com/assets/assets/000/068/862/original/External-Treehouse.svg?1546916799)
## 3D Effect

The 3d pop out effects are created by adhering small strips of paper to the back of our characters. The ends are then attached to the foreground!

Add bends to the ends and then adhere with a glue stick or tape.&nbsp;

## Lid&nbsp;

&nbsp;

Now we can move on to securing the Circuit Playground Express to the Lid.&nbsp;

&nbsp;

Orient the USB port to the opposite side of the opening on the lid.

&nbsp;

Thread the JST connector on the battery pack, through the sipping hole on the lid. Connect it to the Circuit Playground Express.

&nbsp;

Use double stick foam tape to attach to the bottom side of the Circuit Playground Express.&nbsp;

![circuit_playground_lid-parts2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/115/medium640/circuit_playground_lid-parts2.jpg?1545853616)

![circuit_playground_lid-battery-attached.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/116/medium640/circuit_playground_lid-battery-attached.jpg?1545853670)

## Copper Traces&nbsp;

&nbsp;

Build your own traces and route your connections so they’re on the outside of the lid.

&nbsp;

Peel the backing off the copper tape and the press down flat on the lids contour.&nbsp;

&nbsp;

Press to conform to the contours of the lid around to the sides of the lid.&nbsp;

![circuit_playground_lid-trace.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/117/medium640/circuit_playground_lid-trace.jpg?1545853767)

![circuit_playground_lid-traced.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/118/medium640/circuit_playground_lid-traced.jpg?1545853807)

## USB port

&nbsp;

Next we can add a cut out for the USB port. We'll align our usb cable and then mark and cut away material until the usb cable fits flat inside the lid.

![circuit_playground_lid-usb-open.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/119/medium640/circuit_playground_lid-usb-open.jpg?1545853899)

![circuit_playground_lid-usb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/120/medium640/circuit_playground_lid-usb.jpg?1545853935)

## Complete scene

&nbsp;

We'll light up the cup and finish our scene by gluing our characters to our tree fort foreground! We should be able to fit two to three characters per lamp!

&nbsp;

Experiment with all of the different sensors and animations to completely customize your lamp!&nbsp;

![circuit_playground_tabs-glued-back-attach.jpg](https://cdn-learn.adafruit.com/assets/assets/000/068/121/medium640/circuit_playground_tabs-glued-back-attach.jpg?1545854060)

![circuit_playground_color-touch.gif](https://cdn-learn.adafruit.com/assets/assets/000/068/122/medium640thumb/circuit_playground_color-touch.jpg?1545854089)

![](https://cdn-learn.adafruit.com/assets/assets/000/068/152/medium800thumb/circuit_playground_hero-rain-loop.jpg?1545874407)


## Featured Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll

[Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll](https://www.adafruit.com/product/1128)
Copper tape can be an interesting addition to your toolbox. The tape itself is made of thin pure copper so its extremely flexible and can take on nearly any shape. You can easily solder to it, and the tape itself can carry current just like a wire. On the back is an electrically conductive...

In Stock
[Buy Now](https://www.adafruit.com/product/1128)
[Related Guides to the Product](https://learn.adafruit.com/products/1128/guides)
### 3 x AAA Battery Holder with On/Off Switch and 2-Pin JST

[3 x AAA Battery Holder with On/Off Switch and 2-Pin JST](https://www.adafruit.com/product/727)
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries and have an on-off switch. That makes...

In Stock
[Buy Now](https://www.adafruit.com/product/727)
[Related Guides to the Product](https://learn.adafruit.com/products/727/guides)

## Related Guides

- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Giant Mechanical Keyboard](https://learn.adafruit.com/giant-control-alt-delete.md)
- [Makecode para la Circuit Playground Express](https://learn.adafruit.com/makecode-es.md)
- [The MonkMakes Plant Monitor and CircuitPython](https://learn.adafruit.com/monkmakes-plant-monitor-and-circuitpython.md)
- [LED Reactive Light-Up Hockey Puck in MakeCode](https://learn.adafruit.com/led-hockey-puck.md)
- [Secret Hollow Book Intrusion Detector](https://learn.adafruit.com/secret-hollow-book.md)
- [CircuitPython Hardware: LED Backpacks & FeatherWings](https://learn.adafruit.com/micropython-hardware-led-backpacks-and-featherwings.md)
- [Fireflies with MakeCode](https://learn.adafruit.com/circuit-playground-fireflies-makecode.md)
- [Cartoon Network MakeCode: Garnet's Palm Gems from Steven Universe](https://learn.adafruit.com/cartoon-network-makecode-garnet-s-palm-gems-from-steven-universe.md)
- [Halloween Sentry-Bot with CRICKIT for CPX](https://learn.adafruit.com/halloween-sentry-bot.md)
- [Circuit Playground Express Laser Tag](https://learn.adafruit.com/circuit-playground-express-laser-tag.md)
- [Perfect Pitch Machine](https://learn.adafruit.com/perfect-pitch-machine.md)
- [LED NeoPixel Corset with Circuit Playground Express and MakeCode](https://learn.adafruit.com/led-corset-with-circuit-playground-and-makecode.md)
- [Bunny Ears with MakeCode](https://learn.adafruit.com/bunny-ears-with-makecode.md)
- [Program CircuitPython USB Devices with iPhone & iPad](https://learn.adafruit.com/use-circuitpython-devices-with-iphone-ipad.md)
- [Scratch 3 Walkthrough and Demo](https://learn.adafruit.com/guide-to-scratch-3.md)
