0.6.4 • Published 8 years ago

xln v0.6.4

Weekly downloads
2
License
ISC
Repository
github
Last release
8 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

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago