We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there,
I'm trying to get the step counter using below sample code in your doc:
console.log('Enable acc steps.'); MetaWear.mbl_mw_acc_bmi160_enable_step_counter(device.board); MetaWear.mbl_mw_acc_bmi160_write_step_counter_config(device.board); console.log('Get step signal.'); let signal = MetaWear.mbl_mw_acc_bmi160_get_step_counter_data_signal(device.board); console.log('Set up read.'); MetaWear.mbl_mw_datasignal_subscribe(acc, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => { var data = pointer.deref(); var value = data.parseValue(); console.log('epoch: ' + data.epoch + ' acc: ' + value.x + ' ' + value.y + ' ' + value.z); })) console.log('Read.'); MetaWear.mbl_mw_acc_start(device.board); MetaWear.mbl_mw_datasignal_read(signal);
When I run the JS file using NODE, it juts hangs and not getting any console.logs.
But I can run below methods without any issues:
let acc = MetaWear.mbl_mw_acc_get_acceleration_data_signal(device.board) let gyro = MetaWear.mbl_mw_gyro_bmi160_get_rotation_data_signal(device.board)
Do I need to include anything else except below? Could you please advise?
var MetaWear = require('../index'); var ref = require('ref');
The text was updated successfully, but these errors were encountered:
Fixed it by resetting the BLUETOOTH and the DEVICE. I also had to use below code:
var MetaWear = require("../index.js") //require('metawear'); var ref = require("ref") var accelerometerBMI160StepCount = 0 async function mainAsync(mac) { var device = await new Promise((resolve, reject) => MetaWear.discoverByAddress(mac.toLowerCase(), (d) => resolve(d)) ) await new Promise((resolve, reject) => { console.log("Connecting...") device.connectAndSetUp((error) => { console.log("Connected.") if (error == null) resolve(null) else reject(error) }) }) console.log("Enable acc steps.") let acc = MetaWear.mbl_mw_acc_bmi160_get_step_detector_data_signal( device.board ) console.log("Set up stream.") MetaWear.mbl_mw_datasignal_subscribe( acc, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer((ctx, pointer) => { accelerometerBMI160StepCount += 1 console.log("Steps:" + accelerometerBMI160StepCount) }) ) console.log("Start accelerometer.") MetaWear.mbl_mw_acc_bmi160_enable_step_detector(device.board) MetaWear.mbl_mw_acc_start(device.board) process.openStdin().addListener("data", (data) => { console.log("Reset.") MetaWear.mbl_mw_debug_reset(device.board) MetaWear.mbl_mw_macro_erase_all(device.board) MetaWear.mbl_mw_debug_reset_after_gc(device.board) MetaWear.mbl_mw_debug_disconnect(device.board) }) } mainAsync("MAC-ADDRESS-OF-THE-DEVICE")
Sorry, something went wrong.
No branches or pull requests
Hi there,
I'm trying to get the step counter using below sample code in your doc:
When I run the JS file using NODE, it juts hangs and not getting any console.logs.
But I can run below methods without any issues:
Do I need to include anything else except below? Could you please advise?
The text was updated successfully, but these errors were encountered: