But first program in smart.js I wrote. It cost me a few hours of my time, because everything is different than declaring Cesanta.
Tested with smart.js APLHA2:
// JavaScript - blinkig LED on GPIO0
// test GPIO.setmode(), GPIO.write() and GPIO.read()
var led =1;
var pin =0; // GPIO0 = 0, GPIO1 = 1 (blueLED)... etc
var mod =0; // 0 = I/O, 1 = INP, 2 = OUT, 3 = Interrupt
var pul =1; // 0 = floating, 1 = pullup, 2 = pulldown resistor
GPIO.setmode(pin, mod, pul)
function blink() { GPIO.write(pin,led);
if (led==1) {led=0} else {led=1}; print(pin,mod,pul,GPIO.read(pin));
setTimeout(blink, 1000);}
blink()
Note: for start of program aply File.eval('file-name.js')