DeviceScript is a project that aims at bringing a TypeScript development experience to microcontrollers.

TypeScript is JavaScript with syntax for types. DeviceScript supports a subset of TypeScript. The TypeScript sources are compiled to a compact bytecode which is executed on the microcontroller by a native runtime. It is in many ways similar to CircuitPython, but for TypeScript instead.

DeviceScript is an incubation project from Microsoft Research by the same team that started MakeCode.

Blinky

To get started, this little program blinks the onboard LED on your device. It can be run on a simulator or on a physical device. Follow this guide to learn more.

// A blinking animation on the onboard LED
import { delay } from "@devicescript/core"
import { setStatusLight } from "@devicescript/runtime"

// start an interval time every 10ms
setInterval(async () => { // async, await!
    // turn off
    await setStatusLight(0)
    await delay(1000)
    // turn on
    await setStatusLight(0x0f0f0f)
    await delay(1000)
}, 10)

Supported Hardware

DeviceScript is current supported on ESP32 and RP2040 (full list). In particular, DeviceScript already provides the pinout configuration for various Adafruit boards such as the QT Py ESP32-C3 WiFi. More can be added...

Guides

This guide will build a program that collects sensor data (temperature) and uploads it to Adafruit IO. A few aspects of DeviceScript are covered that are relevant to Adafruit hardware, and Adafruit IO.

For more in-depth information, refer to the DeviceScript documentation.

This guide was first published on Jul 26, 2023. It was last updated on Mar 08, 2024.

This page (What is DeviceScript?) was last updated on Mar 08, 2024.

Text editor powered by tinymce.