All Projects → Loghorn → ant-plus

Loghorn / ant-plus

Licence: MIT license
A node module for ANT+

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to ant-plus

redcanary-ebpf-sensor
Red Canary's eBPF Sensor
Stars: ✭ 52 (-55.93%)
Mutual labels:  sensor
pymetawear
Community developed SDK around the Python bindings for the C++ SDK
Stars: ✭ 42 (-64.41%)
Mutual labels:  sensor
imu ekf
6-axis(3-axis acceleration sensor+3-axis gyro sensor) IMU fusion with Extended Kalman Filter.
Stars: ✭ 56 (-52.54%)
Mutual labels:  sensor
canairio sensorlib
Particle sensor manager for multiple sensors: Honeywell, Plantower, Panasonic, Sensirion, etc. This is sensors layer of CanAirIO project too.
Stars: ✭ 24 (-79.66%)
Mutual labels:  sensor
pct
Build automation for OpenEdge ABL
Stars: ✭ 87 (-26.27%)
Mutual labels:  ant
ant-design-pro-tabs
基于pro2.0/4.0制作的多标签版本,直接引入组件即可使用,十分方便
Stars: ✭ 68 (-42.37%)
Mutual labels:  ant
TLE5012-Magnetic-Angle-Sensor
This repository includes an library for Arduino for the TLE5012 Magnetic Angle Sensor with SSC interface.
Stars: ✭ 37 (-68.64%)
Mutual labels:  sensor
ventilator
Open source turbine based medical ventilator developed by CRUX (www.cruxbd.com)
Stars: ✭ 21 (-82.2%)
Mutual labels:  sensor
ha-iaquk
Indoor Air Quality Sensor Component for Home Assistant
Stars: ✭ 57 (-51.69%)
Mutual labels:  sensor
teraranger
Ros nodes for single TeraRanger sensors
Stars: ✭ 19 (-83.9%)
Mutual labels:  sensor
ha-multiscrape
Home Assistant custom component for scraping (html, xml or json) multiple values (from a single HTTP request) with a separate sensor/attribute for each value. Support for (login) form-submit functionality.
Stars: ✭ 103 (-12.71%)
Mutual labels:  sensor
Finite-State-Machines
Implementation of the algorithm in the C#. https://tproger.ru/translations/finite-state-machines-theory-and-implementation/
Stars: ✭ 13 (-88.98%)
Mutual labels:  ant
Compass
Compass on Android
Stars: ✭ 47 (-60.17%)
Mutual labels:  sensor
Adafruit CCS811
Arduino driver for CCS811 digital gas sensor
Stars: ✭ 60 (-49.15%)
Mutual labels:  sensor
pysensors
PySensors is a Python package for sparse sensor placement
Stars: ✭ 47 (-60.17%)
Mutual labels:  sensor
SparkFun CCS811 Arduino Library
A library to drive the AMS CCS811 air quality sensor
Stars: ✭ 38 (-67.8%)
Mutual labels:  sensor
loadkit
Java 资源加载器,充分拓展ClassLoader#getResources(name)的能力,实现递归加载,支持普通风格 / 包名风格 / ANT风格 / 正则风格路径的资源加载同时支持自定义过滤器,通常作为框架的基础类库。
Stars: ✭ 39 (-66.95%)
Mutual labels:  ant
dana
DANA: Dimension-Adaptive Neural Architecture (UbiComp'21)( ACM IMWUT)
Stars: ✭ 28 (-76.27%)
Mutual labels:  sensor
ACS712
Arduino library for ACS Current Sensor - 5A, 20A, 30A
Stars: ✭ 41 (-65.25%)
Mutual labels:  sensor
homebridge-airrohr
HomeBridge module for the DIY luftdaten.info particulates sensor. See http://luftdaten.info how to build your own
Stars: ✭ 48 (-59.32%)
Mutual labels:  sensor

ant-plus

A node.js module for ANT+

Prerequisites

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

Windows

Use Zadig to install the WinUSB driver for your USB device. Otherwise you will get LIBUSB_ERROR_NOT_SUPPORTED when attempting to open devices.

macOS

On macOS (tested on High Sierra and Mojave), installing ant-plus will also install the required libusb.

Make sure that Garmin Express is not running, because it will attach to the ANT+ stick and prevent ant-plus from doing so.

Install

npm install ant-plus

usage

var Ant = require('ant-plus');

Create USB stick

var stick = new Ant.GarminStick3;

Create sensors

var sensor = new Ant.HeartRateSensor(stick);

Attach events

sensor.on('hbData', function (data) {
    console.log(data.DeviceID, data.ComputedHeartRate);
});

stick.on('startup', function () {
    sensor.attach(0, 0);
});

Open stick

if (!stick.open()) {
    console.log('Stick not found!');
}

scanning

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!');
}

Important notes

  • never attach a sensor before receiving 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

Objects

GarminStick2 and GarminStick3

GarminStick2 is the driver for ANT+ sticks with a USB product ID of 0x1008. As well as the old Garmin USB2 ANT+ stick, this works with many of the common off-brand clones.

GarminStick3 is the driver for the mini Garmin ANT+ stick which has a USB product ID of 0x1009.

properties

maxChannels

The maximum number of channels that this stick supports; valid only after startup event fired.

methods

is_present()

Checks if the stick is present. Returns true if it is, false otherwise.

open()

Tries to open the stick. Returns false on failure.

openAsync(callback)

Tries to open the stick, waiting for it if not available right now. Returns a cancellation token with a method cancel you can use to stop waiting. callback is a function accepting a single Error parameter and it will be called when the stick is open (with the parameter undefined) or in case of failure (with the parameter set to the error).

close()

Closes the stick.

events

startup

Fired after the stick is correctly initialized.

shutdown

Fired after the stick is correctly closed.

Common to all Sensors

methods

attach(channel, deviceId)

Attaches the sensors, using the specified channel and deviceId (use 0 to connect to the first device found).

detach()

Detaches the sensor.

events

attached

Fired after the sensor is correctly attached.

detached

Fired after the sensor is correctly detached.

Common to all Scanners

methods

scan()

Attaches the sensors and starts scanning for data from every devices in range.

detach()

Detaches the sensor.

events

attached

Fired after the sensor is correctly attached.

detached

Fired after the sensor is correctly detached.

HeartRate

events

hbData

Fired when new heartbeat data is received.

SpeedCadence

methods

setWheelCircumference(circumferenceInMeters)

Calibrates the speed sensor. Defaults to a wheel with diameter of 70cm (= 2.199).

events

speedData

Fired when a new wheel speed is calculated.

cadenceData

Fired when a new pedal cadence is calculated.

StrideSpeedDistance

events

ssdData

Fired when new data been calculated.

BicyclePower

events

powerData

Fired when new power has been calculated.

FitnessEquipment

events

fitnessData

Fired when new data is received.

Environment

events

envData

Fired when data is received.

The state.EventCount value can be used to tell when a new measurement has been made by the sensor - it's value will have been incremented.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].