Use nodejs write code to control webduino LED

webduino support graphical programming, so you can use it to control LED .

if you check the red box button, you can see js code:

var rgbled;

boardReady({board: 'Smart', url: ''}, function (board) {
    board.samplingInterval = 50;
    rgbled = getRGBLedCathode(board, 15, 12, 13);

so we can try to use nodejs to control it:

first , we can start official open source js,code at :

at first , you must install nodejs .

1, create a led dir 2, install webduino js lib

cd led
npm install webduino-js

3 ,create led.js file:

var webduino = require('webduino-js');

var board, rgbled;

board = new webduino.board['Smart']({url: ''});

function getRGBLedCathode(board, red, green, blue) {
    return new webduino.module.RGBLed(board, board.getDigitalPin(red), board.getDigitalPin(green), board.getDigitalPin(blue), webduino.module.RGBLed.COMMON_CATHODE);

board.on('ready', function() {
    console.log("board ready")
    board.samplingInterval = 500;
    rgbled = getRGBLedCathode(board, 15, 12, 13);
    console.log("board end")

so you can control led with nodejs code.