• Say hello to Node 8!

    Wednesday, August 8, 2018

    In our effort to keep the Tessel 2 updated with the latest Node LTS (Long Term Support) version, we’re proud to announce the latest firmware release with Node 8!

    Node.js Release Schedule

    After becoming the LTS version at the end of October 2017, Node 8 will stay under active support until April 2019 and under maintenance until the end of that year.

    With Node 8 comes a slew of new features, including a speedy update to the V8 runtime and the introduction of async / await.

    An asynchronous function is a function which operates asynchronously via the event loop, using an implicit Promise to return its result.

    async function declarations allow for asychronous code to be written in a synchronous-looking way, which is very handy with hardware and networking platforms like Tessel. No more nested callbacks or Promise.then chains to manage wireless connections or messy conditionals for async responses. Because the Tessel API uses the standard Node-style callbacks, the built-in util.promisify function can be used to make the API ready for async / await.

    A nice example for blinking an LED where we want to wait 2 seconds between blinks:

    With async / await:

    const tessel = require('tessel');
    const green = tessel.led[2];
    const sleep = (wait = 2000) => new Promise((resolve) => setTimeout(resolve, wait));
    
    // no top-level await yet
    (async function blink () {
      green.toggle();
      await sleep();
      blink();
    })();
    

    Without:

    const tessel = require('tessel');
    const green = tessel.led[2];
    
    (function blink () {
      green.toggle(() => {
        setTimeout(blink, 2000);
      });
    })();
    

    While the callback nesting is not too bad in the latter example, the former reads like more synchronous and readable logic.

    You can update your Tessel 2 through the t2-cli by running t2 update, which will take a few minutes to download and install. After it is complete, running t2 version should show the following output:

    $ t2 version
    INFO Looking for your Tessel...
    INFO Connected to ava.
    INFO Tessel Environment Versions:
    INFO t2-cli: 0.1.19
    INFO t2-firmware: 0.3.0
    INFO Node.js: 8.11.3
    

    Let us know what awesome projects you’re building with Tessel by mentioning @tesselproject on Twitter. Happy Creating! 🤖

    #

August 2018

January 2018

July 2017

February 2017

November 2016

October 2016

September 2016

August 2016

July 2016

June 2016

April 2016

March 2016

February 2016

November 2015

September 2015

August 2015

July 2015

June 2015

May 2015

March 2015

February 2015

January 2015

December 2014

November 2014

October 2014

September 2014

August 2014

July 2014

June 2014

May 2014

April 2014

March 2014

February 2014

January 2014

December 2013

November 2013

October 2013

September 2013

August 2013

July 2013