Class: FrequencyGenerator

Inherits:
ArduinoSketch show all
Defined in:
lib/examples/frequency_generator.rb

Instance Attribute Summary

Attributes inherited from ArduinoSketch

#pins

Instance Method Summary collapse

Methods inherited from ArduinoSketch

#add, add_to_setup, #array, #assembler, #comment_box, #compose_setup, #define, #delay, #digitalWrite, #formatted_print, #initialize, #input_pin, #input_pins, output_pin, #output_pin, post_process_ruby_to_c_methods, pre_process, #serial_begin

Methods included from ExternalVariableProcessing

#c_type, #check_variable_type, #post_process_arrays, #post_process_vars, #pre_process_vars, #process_external_vars, #translate_variables

Constructor Details

This class inherits a constructor from ArduinoSketch

Instance Method Details

#loopObject



7
8
9
# File 'lib/examples/frequency_generator.rb', line 7

def loop
    uh_oh 4   
end

#uh_oh(n) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/examples/frequency_generator.rb', line 11

def uh_oh(n)
 

   n.times do
       myTone.enable
       myTone.set_frequency 1800
       delay 500
       myTone.disable
       delay 100
       myTone.enable
       myTone.set_frequency 1800
       delay 800
       myTone.enable
   end
   # hack to help translator guess that n is an int
   f = n + 0
end