Outils pour utilisateurs

Outils du site

ESP8266 with Typescript and esptool


This tutorial describes the minimals steps required to execute yours firsts typescript lines of code on the ESP8266 board. At the end of this post you will be able to execute a “blink” sketch just to test that your stack is up and running.

Typescript is a JavaScript that scales. It supports type annotation, can deduce types. It can compile upper versions of ECMAScript to lower versions like ES5.

ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability.


The steps described in this post have been tested with (and refer to) the stack below, but should work (with minors modifications) in other environments as well:

  • Ubuntu 18.04 [kernel 4.15.0-38-generic]
  • Node 8.9.4
  • Typescript 3.1.3
  • Espruino/esptool 1.87

The boards used for this essay:

  • Wemos D1 R1 mini


  • nodejs ( on Unix - Linux / OS X systems the preferred way is trough nvm)
  • python 2.7+
  • gulp-cli (npm i -g gulp-cli)



pip install esptool
cd esptool

Connect the Esp Board.


Assuming your board is on /dev/ttyUSB0 and accept 115200 baud:

python esptool.py --port /dev/ttyUSB0 erase_flash
python esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash   --flash_freq 80m --flash_mode qio --flash_size 32m   0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin


screen /dev/ttyUSB0 115200

and then:


should result in something like:

={ "free": 1654, "usage": 46, "total": 1700, "history": 15 }


git clone https://github.com/PostTenebrasLab/espruino-ts-quickstart
cd espruino-ts-quickstart


On one terminal execute:

gulp espruino-console

Build & Flash

On another terminal:

gulp build
gulp send-to-espruino-console

The board should, hopefully, blink.


Modify the constant blinkInterval in the src/app.ts file.

gulp build
gulp send-to-espruino-console
Vous pourriez laisser un commentaire si vous étiez connecté.
projects/esp8266/esp8266_typescript.txt · Dernière modification: 2018/12/09 16:41 par pliski