Closed yowakita closed 8 years ago
I quickly checked the Android SDK source code and it seems you have to extend the STEP_DETECTOR_CONFIG call by the "stepCnt" (by default 0x15, 0x3) -> https://github.com/mbientlab/Metawear-AndroidAPI/blob/04a18a8b3eb79669a3b3f96951953ff1991c26d6/library/src/main/java/com/mbientlab/metawear/impl/DefaultMetaWearBoard.java#L5680
Additionally you might send a STEP_DETECTOR_INTERRUPT_ENABLE request as well. But you have to check -> https://github.com/mbientlab/Metawear-AndroidAPI/blob/04a18a8b3eb79669a3b3f96951953ff1991c26d6/library/src/main/java/com/mbientlab/metawear/impl/DefaultMetaWearBoard.java#L5697
And maybe it's useful to call your script in debug mode to check the whole request/response stream.
For further help it would be useful if you could send a link to the full code. (fork repo + create new feature branch)
When you say
I quickly checked the Android SDK source code and it seems you have to extend the STEP_DETECTOR_CONFIG call by the "stepCnt" (by default 0x15, 0x3)
Do you mean sending a buffer like
buffer = new Buffer(3);
buffer[0] = MODULE_OPCODE;
buffer[1] = 0x15;
buffer[2] = 0x03;
this.device.send(buffer);
into the start
function and then adding
buffer = new Buffer(3);
buffer[0] = MODULE_OPCODE;
buffer[1] = STEP_DETECTOR_INTERRUPT;
buffer[2] = 0x1;
this.device.send(buffer);
to the enableNotifications
function
I don't have anything of substance at the moment, but I would like to create a pedometer app.
I forked your repo and made some changes that I hope are in the right direction in the accelerometer register file.
https://github.com/yowakita/node-metawear/tree/stepCount
Any help on what to do to get it working would make me super happy. I have spent a lot of time looking over the documentation and patterns of your library and the metawear API but I feel like I am not advanced enough to know what I'm doing wrong exactly. Thank you!
Hey @yowakita, i pushed my version of the step counter a few seconds ago: #17 You can call ./examples/stepCounter.js This will print a dot for each step and the sum of all steps after each 5 seconds. The number is provided by internal metawear counter and can be resetted via Accelerometer.resetStepCounter()
In general I added 3 calls to enable the step counter: STEP_DETECTOR_CONFIG STEP_DETECTOR_INTERRUPT_ENABLE STEP_DETECTOR_INTERRUPT
Is it enough, or do you need more functionality or information?
Thats great @brainexe ! I tried out your example and it seems to work very well so far. I'm going to fiddle with the example and study your code a bit this week, thanks so much for your help!
Hello, first of all thank you for creating this module, it has been very useful for me. Pardon my lack of knowledge because a lot of this is still new to me, but I would love to learn more.
I am attempting to create an onStep function for the accelerometer that would utilize the constants you have in the accelerometer.js register file,
Attempting to emulate the code you have now on the onChange function, I wrote a function
Ands added to the
start
functionWhen I write into the example accelerometer.js file,
I don't get an error but I also don't get anything console log. I am certain I am not understanding how buffers and MODULE_OPCODE work. Could you please help?