If you'd prefer to code the Adabot Operation Game with MakeCode, this is the page for you!
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.
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.
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!
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.