> > *The function digitalRead returns the value of the pin does it not?* >
This I do not know first hand as I have never used bonescript. What I can say is that typically, when calling an executable directly from Nodejs ( which is what bonescript uses - Nodejs ), you need to use a callback to capture the output of that executable *if* you wish to use that value from within the script. What I do imagine, as far as how bonescript works. Is that it directly calls an executable of some sort ( custom, or Linux command ), which then returns a value depending on which mode the pin is set as. Jason Kridner should know for sure since he wrote the library, and I could be wrong. I never really examined his code all that well, before I decided it was not for me. *Basically what I ask is, if reading the return value of the digitalRead is > enough, of should I capture the value of the pin via a callback function.* > Ok, so if bonescript does in fact return a value, and if correct ( without a callback ), then there should be no problem. You could / should test the value to make sure it is correct though. *I am writing a small program where I interchange the mode of a pin as > input and output. I am having difficulties doing that. I am a newbie in > javascript, but I am wondering if that is possible at all.* > * Thanks in advance* > I have read on these groups from various people that using a single pin ( GPIO - read / write ) is possible. However, I am left wondering in which case that would be useful. Whatever the case, digitalRead would only work when the pin is configured as GPIO -> IN. Two ways I *think* you may be able to do this is using . . . https://github.com/cdsteinkuehler/beaglebone-universal-io - This would be slow-ish, but you could call config-pin directly from Nodejs. or by using pin(s) the PRU's can switch modes for fast. For something like say a buffer<->external memory. This way would also be far more complex, but should be vastly faster than using universal-io. On Tue, Jan 6, 2015 at 3:29 PM, Vasilis Iliadis <[email protected]> wrote: > The function digitalRead returns the value of the pin does it not? > Basically what I ask is, if reading the return value of the digitalRead is > enough, of should I capture the value of the pin via a callback function. > I am writing a small program where I interchange the mode of a pin as > input and output. I am having difficulties doing that. I am a newbie in > javascript, but I am wondering if that is possible at all. > Thanks in advance > > On Jan 6, 2015 2:44 AM, "William Hermans" <[email protected]> wrote: > > > > How would you plan on getting the information back from digitalRead if > not by using a javascript callback ? > > > > Also, more information is needed. e.g. what is your program goal ? > > > > On Mon, Jan 5, 2015 at 2:38 PM, 'Vasilis Iliadis' via BeagleBoard < > [email protected]> wrote: > >> > >> I am playing with GPIO and digitalRead in bonescript. I noticed that > although digitalRead is fairly fast the callback function takes a while. I > am asking the group if I should wait for the callback to be triggered or > just calling digitalRead is enough!. > >> > >> Thanks > >> > >> -- > >> 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 a topic in the > Google Groups "BeagleBoard" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/ro7_iOAKamM/unsubscribe. > > To unsubscribe from this group and all its topics, 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.
