0.6.4 • Published 10 years ago

xln v0.6.4

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

XLN

SPCI interface for XLN series Programmable DC Power Supplies

This is still a work in progress

Usage

npm install xln --save
import {tcpXLN} from 'xln';

var conn = new tcpXLN({host: 'hostname or IP'}, () => {
  // Connected

  // Read the device's model number, serial number, firmware version, etc.
  conn.getIDN(idn => {
    console.log('Device info: ' + idn);

    // Now we can do more stuff with the connection
    // You can't use more than one xln function at a time

    // Setup a 12V source
    conn.setSourceVoltage(12, () => {
      // 1A current limit
      conn.setSourceCurrent(1, () => {
        // Enable the output
        conn.setOutput(true, () => {
          // Delay just a little bit before checking the current
          setTimeout(() => {
            conn.getMeasuredCurrent(current => {
              console.log(current);
              // values are returned as strings

              // Current might look like this right now: '0.000'
              console.log((parseFloat(current) > 0) ? 'Load detected' : 'No load');

              // Do more stuff...

              // Close the connection
              conn.end();
            });
          }, 400);
        });
      });
    });
  });
});

conn.on('error', err => {
  console.log('Connection error');
  // Error as reported by nodejs Socket
  console.log(err);
}
0.6.4

10 years ago

0.6.3

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago