class HelloPaLcd

Public Instance Methods

loop() click to toggle source
# File lib/examples/hello_pa_lcd.rb, line 25
def loop  
  say_hello     if button_one.read_input 
  say_more      if button_two.read_input 
  say_it_large  if button_three.read_input 
end
say_hello() click to toggle source
# File lib/examples/hello_pa_lcd.rb, line 31
def say_hello
  @toggle = true
  my_lcd.clearscr "Any sufficiently    advanced technology"
  my_lcd.setxy 0,2
  my_lcd.setxy 0,3, "toggle state: "
  my_lcd.print @toggle
end
say_it_large() click to toggle source
# File lib/examples/hello_pa_lcd.rb, line 47
def say_it_large

  my_lcd.intoBignum
  my_lcd.clearscr            # line 0, col 0
  1.upto(32) do |i|
    my_lcd.setxy 0,1
    my_lcd.print i * i
    delay 200
  end
  my_lcd.outofBignum
end
say_more() click to toggle source
# File lib/examples/hello_pa_lcd.rb, line 39
def say_more # passing print strings to home and setxy (also works on clearscr)
  @toggle = false
  my_lcd.clearscr "is indistinguishablefrom magic"
  my_lcd.setxy 0,3, "toggle state: "
  my_lcd.print @toggle
end
setup() click to toggle source
# File lib/examples/hello_pa_lcd.rb, line 17
def setup
  delay 3000
  my_lcd.setxy 0,0
  my_lcd.print "Press button"
  my_lcd.setxy 0,1
  my_lcd.print "One, two or three...."
end