If you'd prefer to code the Adabot Operation Game with MakeCode, this is the page for you!

Getting Started with MakeCode

If you're new to MakeCode, head to this guide to get started. Once you're able to upload MakeCode to your Circuit Playground Express, return here.

Operation MakeCode

The key feature of Operation is that the lights and buzzers alarm whenever your tweezers touch the edge of a hole. We've connected the copper tape at each hole to a capacitive touch pad on the Circuit Playground Express -- now we want to code the board in MakeCode to react.

On Start

First, we set all the pixels to white, with the set all pixels block from the NEOPIXEL category.

Then set the capacitive touch threshold on all pins to 1000 with the button pin A1 set threshold 200 block found in the INPUT category.  You can adjust this value as needed in case your tweezers aren't causing the copper tape and alligator jumper wire antennae to trigger!

Per Pin Block

The rest of the code is very simple! We're going to create an on button A click block from the INPUT category and then change it to on pin A1 down. This is how you can test a pad for a capacitive touch event.

Inside this block we'll set the pixels red when the pad has triggered, and then play a tone. Finally, we'll change the pixels to a unique color, in this case, magenta.

Simply duplicate this block six times, changing each one to use a different pad from A2-A7, and adjusting the colors. That's all there is to it!

Click this button to open the live MakeCode session in your browser.

This guide was first published on Aug 17, 2018. It was last updated on Mar 26, 2024.

This page (Code with MakeCode) was last updated on Mar 08, 2024.

Text editor powered by tinymce.