digital_read?

0 views
Skip to first unread message

Max

unread,
Aug 4, 2009, 7:58:55 PM8/4/09
to Ruby Arduino Development
Howdy,

I have greg's RAD, and digital_read is mentioned a few times in the
documentation, but the method itself is missing! Is there a fork
somewhere with this implemented yet?

JD Barnhart

unread,
Aug 4, 2009, 9:55:10 PM8/4/09
to ruby-arduino...@googlegroups.com
If you want to read a button-like item (doesn't need to be a button) you could declare it as a button and use .read_input -- refer to the examples for exact usage.

Ron Evans

unread,
Aug 5, 2009, 5:53:37 AM8/5/09
to ruby-arduino...@googlegroups.com
You should be able to digital_read like this:

if you have declared
input_pin 8, :as => :my_input

then you can use
my_val = my_input.digital_read
for a more ruby-ish syntax

or
my_val = digital_read(my_input)
to be more like other arduino example code you might find on the intertubez.

Hope this helps!

Ron Evans
@deadprogram
http://deadprogrammersociety.com
--
Ron Evans
310-597-1013
ron....@gmail.com

Max

unread,
Aug 5, 2009, 12:31:12 PM8/5/09
to Ruby Arduino Development
read_input worked a charm!

On Aug 5, 2:53 am, Ron Evans <ron.ev...@gmail.com> wrote:
> You should be able to digital_read like this:
>
> if you have declared
> input_pin 8, :as => :my_input
>
> then you can use
> my_val = my_input.digital_read
> for a more ruby-ish syntax
>
> or
> my_val = digital_read(my_input)
> to be more like other arduino example code you might find on the intertubez.
>
> Hope this helps!
>
> Ron Evans
> @deadprogramhttp://deadprogrammersociety.com
>
>
>
> On Tue, Aug 4, 2009 at 6:55 PM, JD Barnhart<j...@jdbarnhart.com> wrote:
> > If you want to read a button-like item (doesn't need to be a button) you
> > could declare it as a button and use .read_input -- refer to the examples
> > for exact usage.
>
> > On Tue, Aug 4, 2009 at 4:58 PM, Max <maxosm...@gmail.com> wrote:
>
> >> Howdy,
>
> >> I have greg's RAD, and digital_read is mentioned a few times in the
> >> documentation, but the method itself is missing! Is there a fork
> >> somewhere with this implemented yet?
>
> --
> Ron Evans
> 310-597-1013
> ron.ev...@gmail.com
Reply all
Reply to author
Forward
0 new messages