PulseSensor icon indicating copy to clipboard operation
PulseSensor copied to clipboard

t2 compatibility

Open Frijol opened this issue 10 years ago • 9 comments

Frijol avatar Sep 14 '15 15:09 Frijol

Figure out what's going on here (T2 issue?)

➜  test-community  t2 run pulse.js
INFO Looking for your Tessel...
INFO Connected to Harold over LAN
INFO Writing pulse.js to RAM on Harold (2569.216 kB)...
INFO Deployed.
INFO Running pulse.js...
Collecting samples...
/tmp/remote-script/node_modules/pulsesensor/index.js:35
  var oldTime = new Date(milliseconds);
                         ^
ReferenceError: milliseconds is not defined
    at new PulseSensor (/tmp/remote-script/node_modules/pulsesensor/index.js:35:26)
    at Object.use (/tmp/remote-script/node_modules/pulsesensor/index.js:85:10)
    at Object.<anonymous> (/tmp/remote-script/pulse.js:11:25)
    at Module._compile (module.js:426:26)
    at Object.Module._extensions..js (module.js:444:10)
    at Module.load (module.js:351:32)
    at Function.Module._load (module.js:306:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:117:18)
    at node.js:948:3
INFO Stopping script...

Frijol avatar Sep 14 '15 15:09 Frijol

Hi,

Just got my Tessel2 and the latest PulseSensor npm package is not working. Still, I was able to modify the code and now it's running good.

@Frijol do you plan to update the repository or create a separate branch for Tessel2?

peterschmiz avatar Apr 17 '16 22:04 peterschmiz

would be better to update this package to work with both (there's no good reason it should be different per microcontroller). However, I haven't investigated this issue much. Are you getting the same issue I posted above?

Frijol avatar Apr 18 '16 18:04 Frijol

Yes + the used pin and the read() method had to be changed (read method is now works async).

peterschmiz avatar Apr 18 '16 18:04 peterschmiz

ah, I see. Since T1 is officially deprecated & it seems not easy to make a clean "works-with both" update to this package, probably best to update master to work for T2 and put a note in the Readme that T1 should install at version 0.0.1.

Would you be up for sending me a PR with your T2-functional version of this code?

Frijol avatar Apr 20 '16 01:04 Frijol

Hi, sorry, I was quite busy in the last few days. Sure, I'll send a PR once I cleaned it up.

peterschmiz avatar Apr 25 '16 09:04 peterschmiz

@peterschmiz were you able to get the code to work fully? I can read a value, but it seems that the t2 crashes when trying to read it fast enough. Also, the async callback seems to return fairly late (almost 300ms) and it would be completely unable to actually calculate a heartbeat with it.

rashedtalukder avatar Jun 27 '16 21:06 rashedtalukder

Sorry, I'm quite overwhelmed with my actual daily work, plan to check it this weekend.

peterschmiz avatar Aug 09 '16 12:08 peterschmiz

Also gonna make a PR, if it works :)

peterschmiz avatar Aug 09 '16 12:08 peterschmiz