Class: HelloFormatPrint
- Inherits:
-
ArduinoSketch
- Object
- ArduinoSketch
- HelloFormatPrint
- Defined in:
- lib/examples/hello_format_print.rb
Instance Attribute Summary
Attributes inherited from ArduinoSketch
Instance Method Summary collapse
- #loop ⇒ Object
- #say_hello ⇒ Object
- #say_it_large ⇒ Object
-
#say_more ⇒ Object
passing print strings to home and setxy (also works on clearscr).
- #setup ⇒ Object
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
#loop ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/examples/hello_format_print.rb', line 44 def loop if millis % 500 == 0 write_line "millis()= %ld", millis my_lcd.setxy 1, 2, string_line end say_hello if .read_input say_more if .read_input say_it_large if .read_input end |
#say_hello ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/examples/hello_format_print.rb', line 54 def say_hello @toggle = true my_lcd.clearscr "This sketch has?nbeen running for?n " write_line "%ld mins and %d secs?n", millis/60000, (millis/1000)%60 my_lcd.print string_line delay 3000 my_lcd.clearscr " --<Press Button>--?nOne, Two, or Three" end |
#say_it_large ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/examples/hello_format_print.rb', line 78 def say_it_large my_lcd.intoBignum my_lcd.clearscr # line 0, col 0 1.upto(32) do |i| my_lcd.setxy 0,1 my_lcd.print i * i delay 200 end my_lcd.outofBignum delay 3000 my_lcd.clearscr " --<Press Button>--?nOne, Two, or Three" end |
#say_more ⇒ Object
passing print strings to home and setxy (also works on clearscr)
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/examples/hello_format_print.rb', line 63 def say_more # passing print strings to home and setxy (also works on clearscr) @toggle = false my_lcd.clearscr "Food Store Prices" write_line "Pies $%2d.%02d", @pie_cents/100, @pie_cents%100 # write_line "Pies $%6.2f", @pie_price # float doessn't seem to work ..... my_lcd.setxy 2, 1, string_line # write_line "toggle state is [%s]", @toggle ? "ON" : "OFF" # RubyToC screws this construct up and RAD mistajekl put 1 ad 0 # in place of "ON" and "OFF" write_line "toggle state is [%d]", @toggle my_lcd.setxy 2, 3, string_line delay 3000 my_lcd.clearscr " --<Press Button>--?nOne, Two, or Three" end |
#setup ⇒ Object
40 41 42 |
# File 'lib/examples/hello_format_print.rb', line 40 def setup my_lcd.clearscr " --<Press Button>--?nOne, Two, or Three" end |