Class: HelloArray2

Inherits:
ArduinoSketch show all
Defined in:
lib/examples/hello_array2.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



108
109
110
# File 'lib/examples/hello_array2.rb', line 108

def loop
   x = THROWAWAY
end

#setupObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/examples/hello_array2.rb', line 35

def setup
  
  my_lcd.clearscr "toppings: "
  delay 500
  
  @toppings.each do |a|
    my_lcd.print a
    my_lcd.print " "
    delay 500
  end
  
  my_lcd.setxy 0,1, "pizzas: "
  
  pizzas.each do |p|
    my_lcd.print p
    my_lcd.print " "
    delay 500
  end
  
  my_lcd.setxy 0,2, "names: "
  
  @names.each do |p|
    my_lcd.print p
    my_lcd.print " "
    delay 500
  end
  
  delay 3000
  

  
  my_lcd.clearline 1, @names[2]
  my_lcd.print " [ "
  my_lcd.print pizzas[1]
  my_lcd.print " ]"
  
  delay 2000
  
  my_lcd.clearscr "Multidimensional ?n"
  
  0.upto(2) do |f|
    0.upto(3) do |s|
      my_lcd.print @my_numbers[f][s]
      my_lcd.print ", "
      delay 500
    end
  end
  
  delay 1000
  
  my_lcd.clearscr

   0.upto(1) do |f|
     0.upto(3) do |s|
       my_lcd.print @pizzas[f][s]
       my_lcd.print ", "
       delay 500
     end
   end



   delay 2000
  
  my_lcd.clearscr "Array Load?n"
  1.upto(20) do |x|
#     buffer[x] = 64 + x  # we cannot set array elements yet except to initialize in declaration
    my_lcd.print buffer[x-1]
    my_lcd.print " "
  end
  
end