julianduque / beaglebone-io

BeagleBone Black IO Plugin for Johnny-Five
77 stars 29 forks source link

added clarification note about analogRead #63

Closed abcd-ca closed 6 years ago

abcd-ca commented 6 years ago

about continuous callback calls vs one single call

fivdi commented 6 years ago

@abcd-ca Thanks for the PR :)

I not sure if this is the correct location in the readme for this comment. Continuous reading isn't specific to analogRead. It's also used with digitalRead and i2cRead (both of which also involve Linux-IO).

Would it not be better to add a more general comment to section Johnny-Five Features Supported which linked to the IO Plugins readme?

abcd-ca commented 6 years ago

@fivdi I updated the note to also include digitalRead and i2cRead, good idea. In my opinion it belongs here for the following reasons: I was looking for a way to do analog reads and came across this plugin repo first. From there I discovered Johnny-Five. All I needed was analog read capability and not everything Johnny-Five has to offer. This plugin repo shows a standalone example ("Standalone Usage of BeagleBone-IO") that isn't dependent on Johnny-Five. My note adds clarification to that section and it would have saved me a couple hours to have seen it there. A similar note quite likely belongs on the Johnny-Five side of things too but I'm not using that so I haven't looked into it too much.

abcd-ca commented 6 years ago

That being said, is there a simpler alternative to doing analog reads that you know if and would care to share? It was absent from the onoff library which I am also using. Furthermore, I think for my own uses I'll end up hacking the source of the linux-io lib to not do a setInterval loop on the analog read because I really don't need a continuous read of my (battery-voltage) analog pin. Thank you for your time to discuss!

fivdi commented 6 years ago

In my opinion it belongs here for the following reasons...

The reasoning here makes sense to me.

That being said, is there a simpler alternative to doing analog reads

Yes, it's actually very simple to read a value of an analog channel. It's only necessary to read a file. The details can be seen at https://github.com/julianduque/beaglebone-io/blob/master/lib/analog-input.js.

fivdi commented 6 years ago

@abcd-ca Thanks.