Frequently Asked Questions
What is Espruino?
However Espruino itself isn't just the interpreter firmware or hardware - there's also the Web IDE, command-line tools, documentation, tutorials, and modules which form a complete solution for embedded software development.
Having problems with your Espruino Board?
It's plugged into my PC/Mac - what do I do now?
Have a look at our Quick Start page - this will walk you through exactly what you need to do.
Is there a forum where I can get help?
Yes! It's right here
Is Espruino Open Source?
Yes! It's all available on GitHub
I've created something cool with Espruino, would you like to see it?
How is Espruino different to Arduino & Raspberry Pi?
Espruino vs Tessel 2 - what's better and how are they different?
We get asked this a lot... We think Espruino is better, but we're biased.
The two areas overlap a lot, but the main differences are:
- Tessel 2 has more memory (64MB vs. 64kB)
- Espruino uses a lot less power so it can run for years on a battery
- The Espruino Pico is much smaller (the original Espruino board is only a little smaller)
- Tessel is faster
- Tessel has WiFi built in (but you can plug WiFi or Ethernet modules into Espruino)
- Tessel provide pre-made modules that can be plugged in for certain things - Espruino's emphasis is on using standard hardware that's available cheaply from a variety of vendors.
When I type a command, why does Espruino print '=undefined'?
When a command is executed, Espruino prints '=' followed by the value that is returned. For instance:
>1+2 =3 >analogRead(A0) =0.0324
However if you call a function that doesn't return a value, it will return 'undefined' - which is what you are seeing:
When I type a function, why does Espruino print '=function ...'
Please see the answer to the previous question - when you define a function, the function itself is returned as the value. Espruino prints this to the console in the same way it does with every other command you type.
My code is lost when the power is removed from Espruino. What can I do?
It's as easy as typing
save() in the left-hand side of the IDE. When power is re-applied Espruino will resume where it left off, remembering timers, watches, and even pin state. For certain things (like initialising connected hardware like displays) you'll want to run some code when Espruino starts up, in which case you can
just add a function called
onInit() - this will be executed each time Espruino starts.
For more information, see the final section of the Quick Start guide.
Can I use Espruino to control things from a program on my PC?
Yes! As long as you have a way to send data to the serial port from your program it's simple. All you need to do is send the command
echo(0) - which stops the 'user interface' part of Espruino getting in the way. Then you can send and receive data using commands like
For more information, see the page on Interfacing with a PC.
How fast is Espruino?
For pretty much anything that involves interacting with the real world (Servos, Motors, Lights, etc), Espruino is more than fast enough. Events via setWatch are timestamped, so you can measure pulse widths to within one microsecond (1 / 1,000,000 sec)
To give you a rough idea of speed, the following code will create a 1.5kHz square wave:
So it is executing 3000 times a second while allowing you to run other tasks in the background. You can create much faster square waves using the PWM peripherals.
What isn't Espruino suitable for? Video rendering/processing or analysing large amounts of data. However you can always add Inline Assembly or precompiled JS code if you need some part of your project to execute very quickly.
How power efficient is Espruino?
Very. Because it is event based, the Espruino interpreter can put itself to sleep when it knows no action is required.
This means that code written for Espruino will be substantially more power efficient than the same code written in C, unless the C programmer has explicitly added code to enter low power sleep modes.
Currently, when sleeping, Espruino uses roughly 1/3 of the power that it does when it is busy, however when 'deep sleeping' it can use as little as 20 microamps - see the Power Consumption page for more information.
- Automatic Semicolon Insertion on Newlines
- Labels for break statements
There are other things that probably are good ideas, but that we just haven't implemented yet:
- Regular Expressions
- Unicode (not enough memory)
Will Espruino work on my board?
If it's listed on our Other Boards page, then yes. If it isn't, and it contains a similar processor with the same amount (or more) of Flash and RAM, then give it a try - check out GitHub for build instructions!
Please let us know how you get on - we're always looking to expand our list of supported boards.
Can I use official Espruino Boards in my product? How long will you keep making them for?
Yes, we'd encourage you to use our products in your product - the Pico especially is designed to be easy to embed.
Espruino isn't going anywhere - we'll keep making and supporting all of our boards for the forseeable future. However if something unexpected were to happen, because the Espruino software and hardware is Open Source you'll still be able to make your own boards - meaning that any product using Espruino can be produced for years to come.
Can I sell boards containing the Espruino software?
Yes, as long as you abide by the terms of Espruino's MPLv2 licence and respect the Espruino trademark (eg. don't call your board an Espruino board unless agreed with us).
However, if you are profiting from the community's hard work then we'd apprectiate it if you could find a way to contribute something back - for instance you could Donate, or pay us to produce builds of Espruino for your device.
How much Flash memory is free after installing Espruino, and can I use it?
It depends on your device. Espruino uses between 100kb and 200kb of Flash, plus roughly the same amount of flash as you have RAM if you want to save programs. On smaller devices such as the Olimexino, this means that there is hardly any flash memory free, but on most modern boards you'll be fine.
On nearly all boards you can use the built-in Flash Library to not only get access to Flash memory, but to find out which areas of memory are available for use.
Espruino doesn't support some of my chip's functionality. Can I use it anyway?
Is there an editor that can be used instead of typing everything into a terminal window?
Yes. Currently the best solution for Windows, Mac, Linux and Chromebook is a Chrome Web App that we've designed.
However there are other options too. For instance the espruino command-line tools can be used to load code from the command-line. You can then program Espruino right from your favourite editor.
What is efficient and what isn't? How can I write the fastest code?
See our Performance Notes page.
Is there a 'delay()' function in Espruino?
An actual delay function isn't implemented because it encourages you to write code that causes problems for Espruino. As Espruino doesn't have preemptive multitasking, other tasks cannot execute until the current task has finished. If you make your current task take a long time to execute then it will probably cause problems elsewhere - if serial data or pin changes can't be processed in a sensible time period, the input buffers might overflow and data will be lost.
You can still delay your code quite easily (
var t=getTime()+1000;while(getTime()<t);), but you should seriously consider re-writing your code to use setTimeout and/or digitalPulse - the end result will be a much faster, more efficient piece of code.
Mainly it's because of memory usage.
Yes. Most Espruino boards use relatively standard ST Microelectronics ARM Cortex M3/M4 chips, so any tool that will produce code for those can be used to program the boards. There are extremely good C and C++ compilers available, as well as Lua and Python interpreters for the Cortex M4 chip that is in the Pico.
Got a question about Espruino?
Check out our Forum.
I want to write an article on Espruino. Can I get any more information?
Have we not answered your question here?
Please try asking on the Forum.