Compiling an Arduino firmware written in JavaScript from your Raspberry pi 3 with NectarJS

It's possible to easily compile an Arduino firmware written in JavaScript with NectarJS. Let's start with a simple "Hello World" with a Led.

Support NectarJS on KickStarter

The code

require("arduino");

var ledPin = 8;
arduino.pinMode(ledPin, arduino.OUTPUT);
while(1)
{
        arduino.digitalWrite(ledPin, arduino.HIGH);
        arduino.delay(1000);
        arduino.digitalWrite(ledPin, arduino.LOW);
        arduino.delay(1000);
}

Compilation with Raspberry and injecting with AVRDUDE

We are compiling this code with NectarJS in a standard shell and injecting it with AVRDUDE.

Support NectarJS on KickStarter

Adrien