There are security issues to contend with as well. The second option above
may be the best I mentioned as the app could be made to run under root
privileges, while the Node.js app could be given read privileges to this so
called file in memory( while running as a regular user ). This native app
could then be made to fire off at a certain interval, while the Node.js app
could be made to read the values out at a multiple of the time interval.
OR, Node.js has a FileWatcher Class  method that fires off when a file
changes. . .

Anyway, this is why I personally like Node.js so much as it is object
oriented / event driven, with a lot of meat to it. It is also non blocking,
and very fast. Lots to like . . . Good luck.


On Sun, Jun 8, 2014 at 7:12 PM, William Pretty Security <
[email protected]> wrote:

> Thanks J
>
>
>
> Yeah, I think we both found the same tutorial. Anyhow the code seems to
> work.
>
> Just have to test it with the hardware tomorrow.
>
>
>
> It’s just cosmetic, but I’m trying to write the information to a text box
> or something now.
>
> The main thing is it works !
>
>
>
> The book should be out in a couple of months.
>
>
>
> Later;
>
>
>
> Bill
>
>
> http://www.packtpub.com/building-a-home-security-system-with-beaglebone/book
>
>
>
> *From:* [email protected] [mailto:[email protected]]
> *On Behalf Of *William Hermans
> *Sent:* Sunday, June 08, 2014 9:57 PM
>
> *To:* [email protected]
> *Subject:* Re: [beagleboard] Re: Reading an Analog input from a web page ?
>
>
>
> HI William,
>
> There are a few different methods you can use to accomplish this. Just
> keep in mind that I have been doing a lot of reading lately on Node.js( the
> last year or so ), but I am no expert.
>
> First if the input you're reading is accessible via sysfs, you can use
> process.exec( I think it is ) to read the value into a javascript variable
> to display on the webpage.
>
> Secondly, I believe you could write an app that reads the value( perhaps
> using mmap ), and puts it into a "file" in memory, then use process.exec(
> again ) to cat the value into a javascript variable much like the above
> approach.
>
> Anyway, there are surely other options and the two I mentioned above may /
> may not be the  best approach. This is just something that I've been
> researching myself for the last year or so in my spare time "wondering" How
> I personally could achieve a similar goal.
>
>
> http://stackoverflow.com/questions/12941083/get-the-output-of-a-shell-command-in-node-js
>
> The above is one such link I believe that I came across at one point I
> though seemed useful.
>
> BTW, you probably ran into the same alarm clock "app" I ran into recently
> that I thought was kind of cool :)
>
>
>
> On Sun, Jun 8, 2014 at 5:03 PM, William Pretty Security <
> [email protected]> wrote:
>
> Thanks for the reply John
>
>
>
> I found a really good tutorial on the web that uses socket.io to display
> a clock on a web page.
>
> So modifying the code for my purposes was a snap J
>
>
>
> I’ll look into DoJoToolkit anyway.
>
>
>
> Bill
>
>
>
>
> http://www.packtpub.com/building-a-home-security-system-with-beaglebone/book
>
>
>
> *From:* [email protected] [mailto:[email protected]]
> *On Behalf Of *John Syn
> *Sent:* Sunday, June 08, 2014 7:13 PM
> *To:* [email protected]
> *Subject:* Re: [beagleboard] Re: Reading an Analog input from a web page ?
>
>
>
>
>
> *From: *William Pretty Security <[email protected]>
> *Reply-To: *<[email protected]>
> *Date: *Friday, June 6, 2014 at 6:01 PM
> *To: *<[email protected]>
> *Subject: *RE: [beagleboard] Re: Reading an Analog input from a web page ?
>
>
>
> Hi Mark;
>
>
>
> Thanks for the response. I looked at the links, and I think it would be
> easier if provided more detail.
>
> What I am trying to do is a lot less complex (I think) than your examples.
>
>
>
> As part of my latest book for Packt Publishing, I have an RF Power Meter
> design.
>
> Basically you read an analog voltage which is proportional to the RF power
> being measured.
>
> (It could just as easily be temperature) multiply by a correction factor
> to convert millivolts to dBm and then
>
> print out the result.
>
>
>
> I already have test software that does this to the console, but I want to
> now output it to a web page.
>
> The web page already controls a programmable attenuator, using socket.io
> and toggling IO bits.
>
> I don’t need to graph anything; just print a number on the web page that
> corresponds to the RF power.
>
>
>
> I found a couple of files in your git tree called “ioPlot.html” and
> “ioPlot.js”
>
> but I am not sure how to simplify them for my application.
>
> Why not use DojoToolkit and Node.js? I suggest you use websockets which is
> easy to implement in a Node.js web server and also in javascript on a web
> client.
>
>
>
> Regards,
>
> John
>
>
>
> Thanks;
>
>
>
> Bill
>
>
>
>
> http://www.packtpub.com/building-a-home-security-system-with-beaglebone/book
>
>
>
> *From:* [email protected] [mailto:[email protected]
> <[email protected]>] *On Behalf Of *Mark A. Yoder
> *Sent:* Friday, June 06, 2014 4:51 PM
> *To:* [email protected]
> *Subject:* [beagleboard] Re: Reading an Analog input from a web page ?
>
>
>
> p.s.  I also have a homework[1] assignment that gives an overview of it.
>
>
>
> --Mark
>
>
>
> [1] https://drive.google.com/#folders/0B5UNMAgIJB74cUhIRlRwcXdQaTQ
>
> On Friday, June 6, 2014 3:44:36 PM UTC-5, Mark A. Yoder wrote:
>
> William:
>
>   I have an example[1] that not only reads analog in, but it also plots it
> on a web page.
>
>
>
> --Mark
>
>
>
> [1]
> https://github.com/MarkAYoder/BeagleBoard-exercises/tree/master/realtime
>
> On Thursday, June 5, 2014 11:09:58 AM UTC-5, William Pretty Security wrote:
>
> Hello group;
>
>
>
> I am wondering if is possible to read an analog input on the BBB at the
> press of a button on a web page.
>
> I already have code that uses node.js and socket.io to turn on an LED in
> response to a button push.
>
> But I want to Read an input and display the result.
>
>
>
> Does anyone know how to do this ??
>
>
>
> Thanks J
>
>
>
>
> http://www.packtpub.com/building-a-home-security-system-with-beaglebone/book
>
>
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4592 / Virus Database: 3955/7631 - Release Date: 06/06/14
> ------------------------------
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4592 / Virus Database: 3950/7548 - Release Date: 05/23/14
> Internal Virus Database is out of date.
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> ------------------------------
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4592 / Virus Database: 3950/7548 - Release Date: 05/23/14
> Internal Virus Database is out of date.
>
> No virus found in this message.
> Checked by AVG - www.avg.com
>
> Version: 2014.0.4592 / Virus Database: 3955/7644 - Release Date: 06/08/14
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4592 / Virus Database: 3955/7644 - Release Date: 06/08/14
> ------------------------------
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4592 / Virus Database: 3950/7548 - Release Date: 05/23/14
> Internal Virus Database is out of date.
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to