The block editor is the easiest way to get started with MakeCode. You can drag and drop blocks from the category list. Each time you make a change to the blocks, the simulator will automatically restart and run the code. You can test your program in the browser!
Let's show how MakeCode works by building a simple program that blinks the 10 awesome NeoPixels.
Creating a blink effect is done by setting all the ring LEDs to red, pause for a little, then turn them off, pause for a little, then repeat forever.
Let's gather the blocks we need to convert the description above into Blocks that the Circuit Playground can understand and run:
- forever runs blocks in a loop with a 20ms pause in between (it is similar to Arduino loop).
- show ring sets the color on the 10 neopixels at once
- pause blocks the current thread for 100ms. If other events or forever loops are running, they have the opporunity to run at this time.
Do you want to select or change colors? The show ring block has a built-in color picker. Select the color from the color wheel to select a color, then click one of the ten Neopixel rings to modify its color.
How do I disable a Neopixel? The grey dot in the middle of the color wheel indicates that the pixel is off. Select the grey from the color wheel and then click the Neopixel ring.
You can see the Blinky block program in action in the MakeCode editor below. You can also see how the blocks are "slotted together". Clicking the question marks on the box will pop-up a comment to explain what the block does.
In the next section, we'll load the Blinky code onto the Circuit Playground Express!