Hello, (Physical) World!

In your command line, make a folder for your Tessel code, change directory into that folder, and then initialize npm in that folder:

mkdir tessel-codecd tessel-codenpm init -y

You can press enter at each option within npm init to accept npm's defaults.

Great! Now you're set up to run code on Tessel.

Blinking some lights is the "Hello World" of hardware.

Make a new file in your "tessel-code" directory called "blinky.js", and copy/paste this code into it:

// Import the interface to Tessel hardware
var tessel = require('tessel');

// Set the led pins as outputs with initial states
// Truthy initial state sets the pin high
// Falsy sets it low.
var led1 = tessel.led[0].output(1);
var led2 = tessel.led[1].output(0);

setInterval(function () {
    console.log("I'm blinking! (Press CTRL + C to stop)");
    // Toggle the led states
}, 100);

In your command line, enter

tessel run blinky.js

to run your code in Tessel's RAM.

Look at your Tessel! The blue and green LEDs on your Tessel's LED panel should blink back and forth.

Bonus: mess with the code to make the LEDs blink in sync.

Fork on Github