This code sample toggles the switch on or off whenever a loud sound is heard. It also lights up the Circuit Playground's onboard lights for just a moment, to give more feedback when the switch is triggered.
This is a great example of using MakeCode to create a toggle on/off switch with just a few blocks and an
Once you've customized your code, click the Download button at the bottom of the screen. Plug your Circuit Playground into your computer via the USB port. The lights on the face will turn green (if they don't, click the tiny "reset" button in the center of the board) and a drive will appear on your computer called CPLAYBOOT.
To program your Circuit Playground, drag the file you downloaded onto this drive and the code will start running.
If you're having trouble, head over to the MakeCode Beginner Guide for more tips and troubleshooting.