Ways of Programming Espruino

When you've got your Espruino board, there are several different ways you can program it - they're detailed below:

Connection Types

USB

Many Espruino boards have a USB connector, and when you plug this into your PC the board appears as a USB Serial device, which you can then connect to.

This is what we'd suggest programming Espruino devices with.

NOTE: Pixl.js is an exception here - is has a USB connector but it is for charging only.

Bluetooth LE

Puck.js and other Espruino Bluetooth devices present themselves as as Bluetooth LE 'Nordic UART' device, and can be connected to and programmed through that. It's the suggested method of connection for Puck.js.

Adafruit make a Bluetooth LE UART board that can be used to add Bluetooth LE UART capability to other Espruino devices.

Serial / UART

When not connected to a computer by USB, Espruino boards usually open up a serial port on two of their pins at 9600 baud so that they can be programmed via Serial. The pins used for this are detailed in the Pinout section of your board's specific reference page (eg the Pico, where they're marked with !).

NOTE: ESP32 and ESP8266 devices use 115200 baud for serial, not the 9600 that every other Espruino does.

To save power, Puck.js and other Bluetooth Espruinos only power up the serial port if they detect a voltage on the RX pin at boot time. See Puck.js

Bluetooth UART

The Original Espruino Board has a footprint on the back for an HC-05/HC-06 Bluetooth Module. Once soldered, it uses the standard Serial port (detailed above) for communication. For more information see here.

Standard Bluetooth is not the same as Bluetooth LE, and can't be used to communicate from a Website.

WiFi/Ethernet

Currently Espruino boards don't come with Telnet support out of the box. If you're running Espruino on an ESP8266 then Telnet is enabled.

On other boards, once you have a network connection established you can run:

require("net").createServer(function (connection) {
  connection.pipe(LoopbackA);
  LoopbackA.pipe(connection);
  LoopbackB.setConsole();
}).listen(23);

However, using reset() will break your connection.

Headphone Jack

It is even possible to program Espruino from your headphone jack with a few external components! See here!

Applications

Espruino Web IDE

This is what we'd suggest you use for programming Espruino. It comes in a few flavours:

Despite being called a 'Web IDE', the IDE itself (including the fully online version) can function without an internet connection. If you're using modules you may need to download 'offline data' under settings first though!

Espruino Command-line tool

If you have node.js with npm you can install the Espruino command-line tools with npm install -g espruino.

These support USB, Serial, Bluetooth UART (once paired), Bluetooth LE, and Telnet.

You can:

# List what ports are available
espruino --list

# Connect to Espruino and provide a REPL (Ctrl-C exits)
espruino -p your_port

# Connect to Espruino and upload a file
espruino -p your_port code.js

# Connect to Espruino, provide a REPL, and upload the file whenever it changes
espruino -p your_port -w code.js

And much more besides! Full information is here

Third party tools

There are also several third party tools for Espruino available. Some of these may not provide some of the features (like module loading) that are used by tutorials and example code on the Espruino website, and may refuse to upload code that isn't formatted in a K&R style.

Serial Terminals

You can even program Espruino directly from a Terminal application (if using Serial or Telnet), you'll just be lacking some of the code upload features. See Alternative Terminal Apps for more information.

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.