Overview

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

Reference

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

Circuit Playground Express

PRODUCT ID: 3333
Please note: We're still adding full support for all of the cool sensors to MakeCode/CircuitPython/Arduino. We recommend using the CPX with MakeCode only at this time (it does work...
$24.95
IN STOCK
Last updated on 2017-06-07 at 10.10.56 AM Published on 2017-06-07 at 04.42.21 PM