Test NectarJS freely

You can test right now NectarJS with a free unlimited key. follow this link : http://nectar-lang.com/key/ and follow the steps.

If you get problems, the github repos is here : https://github.com/seraum/nectarjs

Install NectarJS

The online documentation is here : http://nectar-lang.com/doc/

You should receive by email your key and setting instructions.

Hello world

Once NectarJS is installed, create a folder test and a file hello.js in it. Open hello.js and write this simple piece of code :

console.log("Hello NectarJS!")

Save and close the file.

Compile and run

Open a shell and go to the test folder. Then, enter this command to compile your file :

nectar --run hello.js

You should see Hello NectarJS! in your console.

In the folder test, you have now a project.json file and a binary file.

You can compile this code for every target you want, just set --target PLATFORM. You can have a list of platform with nectar --help

Compile an arduino Hello World

Create and open a file arduino.js and add this piece of code in it :


var ledPin = 13;
arduino.pinMode(ledPin, arduino.OUTPUT);
    arduino.digitalWrite(ledPin, arduino.HIGH);
    arduino.digitalWrite(ledPin, arduino.LOW);

save and close. Then, enter this command :

nectar --tips --target arduino-uno arduino.js

That's it! Your first Arduino firmware written in JavaScript and compiled with NectarJS. the --tips option outputs some informations and tips. For an Arduino target, the --tips option helps you to flash you arduino with the firmware you have compiled.

As you see, NectarJS is really simple and versatile.