The Adafruit Circuit Playground Express comes packed with built-in sensors. This guide will show you how to leverage them in Microsoft MakeCode. If you are new to MakeCode, make sure to read the MakeCode primer.

Events vs live data

You can use a sensor through events or by reading the live data.

  • Events allow to register code that runs when a particular pattern is detected. For example, the on shake event runs code when a shacking gesture is detected by the accelerometer. You can mix and match events from different sensors in the same program but each event type can only be registered once.
  • Live data gets a live (or slightly filtered) reading of the sensor data. For example, acceleration gets an immediate reading from the accelerometer.

The block code below show the 2 style of programming with sensors. Through events (on shake left) or in the traditional loop style with live data (acceleration right).


Looking for the complete block reference, start at https://makecode.adafruit.com/reference/input .

Circuit Playground Express

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!...
Last updated on 2017-06-07 at 10.10.56 AM Published on 2017-06-07 at 04.42.21 PM