Class: ArduinoMega
Overview
file: arduino_mega.rb
Constant Summary collapse
- @@pins =
(6..13).to_a
Instance Method Summary collapse
-
#initialize(args = []) ⇒ ArduinoMega
constructor
A new instance of ArduinoMega.
- #to_s ⇒ Object
Methods inherited from Arduino
#analog_read, #analog_write, #close, #get_state, #is_high?, #is_low?, #output, #save_state, #set_high, #set_low, #turn_off
Constructor Details
#initialize(args = []) ⇒ ArduinoMega
Returns a new instance of ArduinoMega.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/arduino_mega.rb', line 164 def initialize(args=[]) super(*args) methods = @@pins.map do |x| "def p#{x}h=(bflag)" + \ " @p#{x}h = bflag\n" + \ " send (bflag == true ? :set_high : :set_low), #{x}\n" + \ "end" end self.instance_eval methods.join("\n") #output(*[13,12,11,10,9,8,7,6]) # declare output pins output(*@@pins) # declare output pins if block_given? then yield(self) close() end end |
Instance Method Details
#to_s ⇒ Object
184 185 |
# File 'lib/arduino_mega.rb', line 184 def to_s() end |