A node.js module for ANT+
Libusb is included as a submodule. On Linux, you'll need libudev to build libusb. On Ubuntu/Debian: sudo apt-get install build-essential libudev-dev
Use Zadig to install the WinUSB driver for your USB device. Otherwise you will get LIBUSB_ERROR_NOT_SUPPORTED
when attempting to open devices.
npm install ant-plus
var Ant = require('ant-plus');
var stick = new Ant.GarminStick3;
var sensor = new Ant.HeartRateSensor(stick);
sensor.on('hbdata', function (data) {
console.log(data.DeviceID, data.ComputedHeartRate);
});
stick.on('startup', function () {
sensor.attach(0, 0);
});
if (!stick.open()) {
console.log('Stick not found!');
}
sensor.on('hbdata', function (data) {
console.log(data.DeviceID, data.ComputedHeartRate);
});
stick.on('startup', function () {
sensor.scan();
);
if (!stick.open()) {
console.log('Stick not found!');
}
- never attach a sensor before receiveing the startup event
- never attach a new sensor before receiving the attached or detached event of the previous sensor
- never detach a sensor before receiving the attached or detached event of the previous sensor
The maximum number of channels that this stick supports; valid only after startup event fired.
Checks if the stick is present. Returns true if it is, false otherwise.
Tries to open the stick. Returns false on failure.
Closes the stick.
Fired after the stick is correctly initialized.
Fired after the stick is correctly closed.
Attaches the sensors, using the specified channel and deviceId (use 0 to connect to the first device found).
Detaches the sensor.
Fired after the sensor is correctly attached.
Fired after the sensor is correctly detached.
Fired when new heartbeat data is received.
Attaches the sensors and starts scanning for data from every devices in range.
Detaches the sensor.
Fired after the sensor is correctly attached.
Fired after the sensor is correctly detached.
Fired when new heartbeat data is received.
Attaches the sensor, using the specified channel and deviceId (use 0 to connect to the first device found).
Detaches the sensor.
Calibrates the speed sensor. Defaults to an ~ 700c wheel, 2.118
Fired after the sensor is correctly attached.
Fired after the sensor is correctly detached.
Fired when a new wheel speed is calculated
Fired when a new pedal cadence is calculated