class HelloEepromLcdpa

Public Instance Methods

clear_off_test() click to toggle source
# 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
loop() click to toggle source
# File lib/examples/hello_eeprom_lcdpa.rb, line 69
def loop
  x = 4       # loop has to have _something_
end
setup() click to toggle source
# 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