Skip to content

Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.

Notifications You must be signed in to change notification settings

skittleson/ESP-TypeScript

Repository files navigation

ESP-TypeScript

Version License: ISC Twitter: skittleson nycrc config on GitHub

Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.

Install

npm install

Usage

Adjust port used in package.json then:

npm run-script transpile

Permanently save transpile code on device.

npm run-script commit

Monitor serial responses

npm run-script monitor

Run tests

npm test

Code coverage in coverage/index.html

Example

The simplest example in blinky.ts. Blink a LED.

const BUILTIN_LED = 2;
export function blinkly(intervalMs: number = 2000, pin: number = BUILTIN_LED) {
  let toggleStatus = false;
  setInterval(function () {
    toggleStatus = !toggleStatus;
    digitalWrite(pin, toggleStatus);
  }, intervalMs);
}

More advance example using a class, properties, testing using mocks and type checking: AdvanceBlinky class in advanceBlinky.ts with test at test/blinky.spec.ts.

In depth documentation about Espruino JavaScript API and flashing

Road map

  • Transpile TypeScript to Espruino flavor of JavaScript
  • Example usage of typed code
  • Short commands to build, upload, and monitor
  • Unit testing
  • Firmware guidance docs
  • Integration testing

Devices

Firmware selections

ESP8266 Wemos D1 mini ESP8266

ESP32 Wemos ESP32

These devices are also know to work: https://templates.blakadder.com/

Author

👤 Spencer Kittleson

Show your support

Give a ⭐️ if this project helped you!

About

Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published