forked from atduskgreg/rad
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git@github.com:atduskgreg/rad
- Loading branch information
Showing
8 changed files
with
212 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
class ConfigurePaLcdBoot < ArduinoSketch | ||
|
||
## important! | ||
## most pa_lcd rates are set to 9200, but there are some newer at 19200 | ||
## if you have a 19200, uncomment the end of line 38 | ||
|
||
## purpose: | ||
## change cursor to none | ||
## and add custom boot screen | ||
## | ||
## jd's preferred setup for pa_lcd | ||
## | ||
## assumes 4 x 20 pa_lcd | ||
## | ||
## no blinking cursor press button 1 | ||
## configure custom start up screen - press button 2 | ||
## configure lcd to use custom startup screen - press button 3 | ||
## | ||
## press buttons one, two and three | ||
## or season to taste | ||
## | ||
## refernce | ||
## K107 LCD Controller Board Manual | ||
## page 11 for cursors | ||
## page 13 for custom boot | ||
## http://wulfden.org/downloads/manuals/K107manual.pdf | ||
## | ||
## | ||
|
||
## set pins to your setup | ||
|
||
|
||
input_pin 8, :as => :button_one, :device => :button | ||
input_pin 9, :as => :button_two, :device => :button | ||
input_pin 10, :as => :button_three, :device => :button | ||
|
||
## note, most of these controllers are set to 9200 | ||
output_pin 14, :as => :my_lcd, :device => :pa_lcd #, :rate => 19200 | ||
|
||
|
||
def loop | ||
set_cursor if button_one.read_input | ||
set_custom_screen if button_two.read_input | ||
change_boot_to_custom if button_three.read_input | ||
end | ||
|
||
## assumes 4 x 20 screen | ||
## maintain 20 characters after ?Cn | ||
## wny delays? the controller needs them to give it | ||
## enough time to write 20 bytes to internl EEPROM | ||
def set_custom_screen | ||
my_lcd.clearscr | ||
my_lcd.print "?C0 RAD & Arduino " | ||
delay 400 | ||
my_lcd.print "?C1 Development " | ||
delay 400 | ||
my_lcd.print "?C2 " | ||
delay 400 | ||
my_lcd.print "?C3 v0.3.0 " | ||
end | ||
|
||
|
||
## ?c0 for no cursor | ||
## ?c2 for non blinking cursor | ||
## ?c3 for blinking cursor | ||
def set_cursor | ||
my_lcd.clearscr | ||
my_lcd.print "Changing to " | ||
my_lcd.setxy 0,1 | ||
my_lcd.print "no cursor. " | ||
my_lcd.setxy 0,3 | ||
my_lcd.print "Reboot to view... " | ||
|
||
my_lcd.print("?c0") | ||
end | ||
|
||
## "?S0 for blank screen | ||
## ?S1 for configuration settings | ||
## ?S2 for custom text screen | ||
def change_boot_to_custom | ||
my_lcd.clearscr | ||
my_lcd.print "Changing to " | ||
my_lcd.setxy 0,1 | ||
my_lcd.print "custom boot screen. " | ||
my_lcd.setxy 0,3 | ||
my_lcd.print "Reboot to view... " | ||
my_lcd.print("?S2") | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
class HelloPaLcd < ArduinoSketch | ||
|
||
|
||
# demonstrate 4 x 20 pa_lcd toggle between normal and Bignum mode | ||
# with @toggle external variable thrown in for fun | ||
|
||
# change your pins to suit your setup | ||
|
||
@toggle = false | ||
|
||
input_pin 6, :as => :button_one, :device => :button | ||
input_pin 7, :as => :button_two, :device => :button | ||
input_pin 8, :as => :button_three, :device => :button | ||
|
||
output_pin 5, :as => :my_lcd, :device => :pa_lcd, :rate => 19200, :clear_screen => :true | ||
|
||
def setup | ||
delay 3000 | ||
my_lcd.home | ||
my_lcd.print "Press button" | ||
my_lcd.setxy 0,1 | ||
my_lcd.print "One, two or three...." | ||
end | ||
|
||
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 | ||
|
||
def say_hello | ||
@toggle = true | ||
my_lcd.clearscr | ||
my_lcd.home # line 0, col 0 | ||
my_lcd.print "Any sufficiently advanced technology" | ||
my_lcd.setxy 0,2 | ||
my_lcd.setxy 0,3 | ||
my_lcd.print "toggle state: " | ||
my_lcd.print @toggle | ||
end | ||
|
||
def say_more # passing print strings to home and setxy (also works on clearscr) | ||
@toggle = false | ||
my_lcd.clearscr | ||
my_lcd.home "is indistinguishablefrom magic" | ||
my_lcd.setxy 0,3, "toggle state: " | ||
my_lcd.print @toggle | ||
end | ||
|
||
|
||
def say_it_large | ||
my_lcd.clearscr | ||
my_lcd.intoBignum | ||
my_lcd.home # 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 | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters