Class: HelloEepromLcdpa

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

#clear_off_testObject

clears bottom two lines



74
75
76
77
78
79
# File 'lib/examples/hello_eeprom_lcdpa.rb', line 74

def clear_off_test   # clears bottom two lines 
  delay 2000
  myLCD.clearline 3
  myLCD.clearline 2   # leaves you at start of a 
                           # cleared third line
end

#loopObject



69
70
71
# File 'lib/examples/hello_eeprom_lcdpa.rb', line 69

def loop
  x = 4       # loop has to have _something_
end

#setupObject



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
# File 'lib/examples/hello_eeprom_lcdpa.rb', line 38

def setup
    delay 1500        # give startup screen time to finish and clear
   myLCD.clearscr    "  I2C EEPROM Demo"
    myLCD.setxy 0, 1, "byte write then read"
    myLCD.setxy 0, 2, "  back and display"
    myLCD.setxy 0, 3, "    to the LCD"
    
    clear_off_test
    myLCD.clearline 1, "  byte write test"
    
    myLCD.setxy 0, 2
    32.upto(109) do				# write address of byte to that b yte
	  |x| mem0.write_byte  x, x+7
      myLCD.print(".") if x%2
      delay 10      # EEPROM write _requires_ 3-10 ms pause
    end

    clear_off_test
    myLCD.clearline 1, "  byte read test "

    myLCD.setxy 0, 2
							# read and print 39 addresses with printable numbers
    70.upto(105) { |x| myLCD.print(mem0.read_byte(x)) }

    delay 2000
    clear_off_test
    myLCD.clearline 1, "-< tests complete >- "


end