blinkstick.js
function (serial, callback) {
        var result = [];

        var devices = findBlinkSticks();
        var i = 0;

        var finder = function() {

            if (i == devices.length) {
                if (callback) callback();
            } else {
                devices[i].getSerial(function (err, serialNumber) {
                    if (serialNumber == serial) {
                        if (callback) callback(devices[i]);
                    } else {
                        i += 1;
                        finder();
                    }
                });
            }
        };

        finder();
    }
function (serial, callback) {
        var result = [];

        var devices = findBlinkSticks();
        var i = 0;

        var finder = function() {

            if (i == devices.length) {
                if (callback) callback();
            } else {
                devices[i].getSerial(function (err, serialNumber) {
                    if (serialNumber == serial) {
                        if (callback) callback(devices[i]);
                    } else {
                        i += 1;
                        finder();
                    }
                });
            }
        };

        finder();
    }
function ( serial , callback ) { var result = [ ] ; var devices = findBlinkSticks ( ) ; var i = 0 ; var finder = function ( ) { if ( i == devices . length ) { if ( callback ) callback ( ) ; } else { devices [ i ] . getSerial ( function ( err , serialNumber ) { if ( serialNumber == serial ) { if ( callback ) callback ( devices [ i ] ) ; } else { i += 1 ; finder ( ) ; } } ) ; } } ; finder ( ) ; }
Find BlinkStick device based on serial number.

@static
@method findBySerial
@param {Number} serial Serial number.
@param {Function} callback Callback when BlinkStick has been found
Find BlinkStick device based on serial number .