Method: HelloEeprom#loop

Defined in:
lib/examples/hello_eeprom.rb

#loopObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/examples/hello_eeprom.rb', line 8

def loop
      myLCD.setxy 0,0         # set to 0,0
      myLCD.print rtc.get(5, 1) # refresh registers (=1) get month
    myLCD.print "/"
      myLCD.print rtc.get(4, 0) # no need to refresh (=0) get day 
    myLCD.print "/"
      myLCD.print rtc.get(6, 0) # get year
    myLCD.setxy(0,1)      # set in 1 byte line 1 (second line)
    printlz 2         # print hours with lead zero
    myLCD.print ":"
      printlz 1         # print minutes with lead zero
    myLCD.print ":"
      printlz 0         # print seconds with lead zero
      

    myLCD.setxy 10,0
    myLCD.print "write test"
    myLCD.setxy 0,2
    32.upto(109) do       # write address of byte to that b yte
      |x| mem0.write_byte  x, x
      myLCD.print(".") if x%2
      delay 10
    end

    delay 2000
    
    myLCD.clearline 2   # clears bottom two lines           
    myLCD.clearline 3

    myLCD.setxy 10,0, "read test "
    myLCD.setxy 0,2
                  # read and print 39 addresses with printable numbers
    75.upto(113) { |x| myLCD.print(mem0.read_byte(x)) }
    delay 10000
    myLCD.clearscr
end