Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add speed/cadence sensor #4

merged 5 commits into from Jan 4, 2016

Add speed/cadence sensor #4

merged 5 commits into from Jan 4, 2016


Copy link


This was my first attempt at working with ANT+, as well as my first time doing anything even remotely low-level with JavaScript. So I'm probably getting a few things wrong.

In particular, I'm not so sure what data I'm actually getting back when I receive the CHANNEL_TYPE_ONEWAY_RECEIVE event. It's 3 bytes long but the spec sheet doesn't show anything like that being broadcast on the channel. It seems to always be consistent, so I'm treating it as the DeviceID, which might be completely false! If you're aware of what's actually being broadcast here, I'm happy to fix it up.

Spec sheet:

Closes #3

Usage example in sample/cadence-sensor
Emits two events `speedData` and `cadenceData`

Closes Loghorn#3
Copy link

Loghorn commented Dec 14, 2015

Hi @mattdsteele
thank you for your work.

You can safely ignore the CHANNEL_TYPE_ONEWAY_RECEIVE event: it is used for diagnostic purposes and is not defined by ANT+ protocol (it's probably used by your device manufacturer for its own purposes) so please remove it from the handling function.

Also, you should handle the deviceId === 0 case like it's done in the hearth rate sensor, by sending a MESSAGE_CHANNEL_ID request, because ANT+ dictates that the device id 0 must be used only for pairing (i.e. finding the actual device id).

Finally, it would be awesome if you could also add the scanner for speed/cadence: I could do it based on what you already implemented, but unlike myself you can actually try it 😄

Copy link
Contributor Author

@Loghorn done, feel free to check it out now.

The scanner code wasn't too bad once I extracted the common code out, and it works great. And you're right, sending the MESSAGE_CHANNEL_ID allowed me to get the non-0 channel ID - I think this will help stabilize the runtime behavior quite a bit!

Let me know if there's anything else you'd like added/tested.

Loghorn added a commit that referenced this pull request Jan 4, 2016
@Loghorn Loghorn merged commit 258f37f into Loghorn:master Jan 4, 2016
Copy link

Loghorn commented Jan 4, 2016

Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Adding bicycle speed/cadence sensor
2 participants