JavaScript On Arduino!

The FC1 uses an ARM Cortex M0+. Extremely low-power, but not very powerful. Certainly not powerful enough to run an OS like Linux. That, in addition to the absolute real-time response necessary for a drone to be able to stay in the air, means that high-level scripted languages like JavaScript or Python just can’t be used. Instead, user code is made in C++, then compiled and burned into the chip over USB.

But what if you could run high-level languages like JavaScript, taking advantage of advanced features like the ability to re-write itself as it runs, on a microcontroller? Well, that’s now (sort-of) possible thanks to compact JavaScript compilers!

There are now several different compilers that interpret JavaScript syntax with a small code base, while using minimal RAM, including EspruinoTessel (not open-source), and the absolutely tiny, well, tinyJS! And here’s an article that covers the topic.

The FC1’s processor may be capable of running these compilers, but it’s on the lower end of the spectrum, it’s not multi-core, and it has no built-in means of storing the programs, such as an SD card slot. It can support flash drives via USB OTG, but there’s not really much room for that on a drone. So overall, we’ll probably have to reserve this as a feature for FC2.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s