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 shaking 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).

Reference

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

A Black woman's manicured hand holds a round microcontroller with lit up LEDs.
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
$24.95
In Stock

This guide was first published on Jun 07, 2017. It was last updated on Jun 07, 2017.

This page (Overview) was last updated on Jun 07, 2017.

Text editor powered by tinymce.