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 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.
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.
Is there a forum where I can get help?
Yes! It's right here
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 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 uses around 110 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!
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.
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.
If you have an STM32F1-based board (like the Espruino Board), you can use the STM32F1Flash module to read and write flash memory. On other boards you would have to implement your own flasher using the peek32 and poke32 instructions.
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:
On Windows Raphi H has also produced an IDE for Espruino. See this forum post.
On Linux you can open the serial port to write while it is already open by a terminal application, so you can use your favourite editor, and can then create a custom tool command which executes:
echo 'echo(0)' /dev/ttyUSB0;cp myfile.js /dev/ttyUSB0;echo 'echo(1)' /dev/ttyUSB0
Note the echos - which stop Espruino echoing back the entire file.
Windows/Mac/Linux: There's the node-espruino module, which 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. The 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 THE ESPRUINO BOARD?
I want to write an Article on Espruino. Can I get any more information?
Yes! Head to our Press page. Feel free to contact us if you have any other questions!
Have we not answered your question here?