output_pin 9, :as => :led #pin for led
input_pin 7, :as => :button_one, :device => :button #input pin
of pushbutton
@val = 0 #state of input pin
@old_val = 0 #stores previous value of @val
@state = 0 # 0 = LED off while 1 = LED on
@brightness = 128 #stores brightness value
@startTime = 0 #when did we begin pressing
def loop
@val = digitalRead button_one #read input and store it
#check if there was a transition
if @val == 1 && @old_val == 0 then #this is the line causing
problems
@state = @state - 1 #changes state from off to on and vice
versa
@startTime = millis #millis is the arduino clock returns
number of milliseconds since board was reset
#remembers when button was last pressed
delay 10
end
end
getting following error
private method `gsub' called for nil:NilClass
can someone tell me what I am doing wrong, is there a way to find out
which control statements
or ruby subset work reliably with rad
thanks
Martin
--
You received this message because you are subscribed to the Google Groups "Ruby Arduino Development" group.
To post to this group, send email to ruby-arduino...@googlegroups.com.
To unsubscribe from this group, send email to ruby-arduino-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruby-arduino-development?hl=en.