class HelloClock

Public Instance Methods

loop() click to toggle source
# File lib/examples/hello_clock.rb, line 45
def loop
    mainloop.track
    myLCD.setxy 12,3,  mainloop.get_total
    rtc.get clock, 1
    if clock[0] == 0
      if @flag == 0
        print_main
        @flag = 1
      end
    else
      @flag = 0
    end
    myLCD.setxy 6,2
    printlz clock[2]
    myLCD.print ":"
        printlz clock[1]
    myLCD.print ":"
        printlz clock[0]

   delay 50
    
end
print_main() click to toggle source
printlz(w) click to toggle source
# File lib/examples/hello_clock.rb, line 68
def printlz(w)
                    myLCD.print "0" if w < 10
                    myLCD.print w
end
setup() click to toggle source
# File lib/examples/hello_clock.rb, line 37
def setup
  myLCD.clearscr "   --<Date/Time>--"
  myLCD.setxy 1,3, "looptime = "
  rtc.get clock, 1
  print_main
  @flag = 1
end