Espruino - Program nRF5 devices in JavaScript - See the Puck.js kickstarter

image description

Quick start (< 5 minutes)

  • Download the Espruino Web IDE from the Chrome web store.
  • Drag-and-drop espruino_nrf51.hex or espruino_nrf52.hex to your nRF51/nRF52 Development Kit. Espruino will run on any board with an nRF5 chip, i.e. the Microbit.
  • Open the Espruino Web IDE, select the COM port your nRF5 device is connected to, and start writing JavaScript immediately!

image description

Follow along with the code in the screen-shot below! (Remember the LEDs are inverted on Nordic DKs).

image description

If you run into any trouble or want more info, see: http://www.espruino.com/Quick+Start.

##What is Espruino?

Espruino is a JavaScript run-time that allows resource constrained MCUs (like nRF5 devices) to be programmed entirely in JavaScript. Espruino is open source and community driven, and has had 3 very successful kick-starter campaigns. The most recent kick-starter, Puck.js, features the nRF52 and was fully funded in less than 24 hours! It just started so check it out here: https://www.kickstarter.com/projects/gfw/puckjs-the-ground-breaking-bluetooth-beacon.

Espruino has shipped on over 12,000 boards over the last 3 years, and Nordic started working with them in August 2015 to support nRF5 series devices. Espruino uses Nordic's most recent nRF5 SDK and s130/s132 SoftDevices to expose a very simple and intuitive JavaScript API for many of the peripherals, and BLE (both central and slave capabilities). In addition it implements a lot of the JavaScript standard library. See Espruino FAQs.

Why?

The great thing about using JavaScript is that it opens up the world of microcontrollers to web developers. Boards like Espruino, together with online courses in JavaScript offered by people like CodeAcademy, will provide an easier route for beginners to get into programming. The interactive nature of the interpreter makes it easier to interface to different devices (LCDs, accelerometers, etc...) because commands can be tested one at a time.

The use of JavaScript means you can interpret, inspect and modify your code on the fly. This is different from most existing micro-controllers which run C. It can be like running code in a black box (literally) when you aren't debugging. For example, Espruino's interactive console allows users to enter code such as 'analogRead(LIGHT_SENSOR);' and have it executed, and the result returned immediately. This makes it very different from something like Arduino which requires you to write code, compile, and then upload it to a device. Having an immediate response (good or bad!) to the code you type makes using Espruino a very rewarding experience, and makes it much easier to learn.

JavaScript is also, of course, a familiar and popular language which will be recognized by millions of people around the world, including those who have not learnt to program in C.

Features

  • Event-based nature of JavaScript allows you to easily write energy-efficient code.
  • Built-in HTTP server with support for Ethernet, WiFi and GSM modules.
  • Built-in SD card and FAT filesystem support.
  • Built-in Graphics and Crypto libraries.
  • You can program nRF devices over BLE, no wires needed! https://www.youtube.com/watch?v=HKEHXOSLzCQ.
  • Built-in text mode debugger available, which allows you to step through your code line by line. The commands used are almost identical to those in GDB. http://www.espruino.com/Debugger.

References

Getting involved

To get involved or see the source code see: https://github.com/espruino. Also see the gitter.

There are many different components to this project: hardware/PCB design, firmware, web dev, building and showing off cool projects with Espruino, etc... Feel free to dive in!

Parents Comment Children
No Data