t2 compatibility
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...
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?
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?
Yes + the used pin and the read() method had to be changed (read method is now works async).
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?
Hi, sorry, I was quite busy in the last few days. Sure, I'll send a PR once I cleaned it up.
@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.
Sorry, I'm quite overwhelmed with my actual daily work, plan to check it this weekend.
Also gonna make a PR, if it works :)