Frequently asked questions

I want to use a particular model of sensor, how do I do that?

You can use thousands of mbed C++ libraries to interact with sensors and actuators, but you'll need a C++ to JavaScript binding. If such a binding has not been published, you'll have to provide that to use the library from JavaScript. Follow these instructions, and we'd love it if you pushed the bindings to npm (so they are one npm install mbed-js-your-binding away).

What is the performance impact?

The code within the JavaScript VM runs about a hundred times slower than equivalent C++ code. That sounds like a lot, but everything underneath your application (like drivers, network stacks, crypto) is still C++, so the actual impact will be less noticeable.

How is this different to Johnny Five on Arduino?

With Johnny Five your JavaScript application runs on your computer and then controls your device over USB. With JavaScript on mbed the application runs completely on your device. In other words, you can unplug the device and run it "standalone".

How is this different to node.js on a Raspberry Pi or Tessel 2?

The main difference is power consumption. A Raspberry Pi 3 consumes 220 mA current in idle mode. A microcontroller can use 100,000x less power while in deep sleep. A Bluetooth beacon running JavaScript on mbed can run at least a year on a coin cell.

Can I code without a device?

Not really, but there is a very experimental simulator.