I would say it's not so much about programming paradigm rather than system
calls. It all boils down to how often you would want to read the data.
If it's not more than some times per second, and it's not super important
with timing, you could probably put a reading function in a
SchedulingThreadPool (you can add Clojure functions as is since they are
Runnable) or have a look at the at-at library spawned from overtone.
https://github.com/overtone/at-at
One way to react on the incoming values are to swap! or reset! them into an
atom, which has a watcher-function added which could things based on the
new and old values.
http://clojuredocs.org/clojure_core/clojure.core/add-watch shows an example
with agents, but it works for atoms as well.
If you want to store an incoming series of values for further processing,
either use the clojure.lang.PeristentQueue or some Java equivalent.
If you want to sample in very high frequency, (kilohertz) you'll need to
fetch the values in some loop close to machine an batch it into Clojure by
primitive-buffers or similar (like soundcards, UARTs and network stacks do).
/Linus
2014-06-18 5:08 GMT+02:00 Jeremy Wright wright...@gmail.com:
The main way of reading the inputs (analog or digital) on a BeagleBone
Black is through the Linux file system.
http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc
I'm still pretty new to Clojure and come from an object oriented
background. I would like to do a continuous read of the BBB's analog inputs
through the file system and make decisions based on the values. There are
different ways of handling this from an OOP perspective, but I'm not sure
how to approach it from a functional perspective. Can someone point me in
the right direction?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with
your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an
email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.