#!/usr/sbin/blassic '/home/graham/i2c/solar/print_word.bas <1=clear/0-noclear> ' send a string to the i2c LCD (no spaces in the string) word$ = PROGRAMARG$(1) word_length = LEN(word$) line$ = PROGRAMARG$(2) 'line to print to (1 to 4) starting_column = VAL(PROGRAMARG$(3))-1 'starting column (1 to 20) IF PROGRAMARG$(4) = "1" THEN SHELL "i2cset -y 0 0x63 0x0 0x0C b > /dev/null 2>&1" 'clear screen IF PROGRAMARG$(5) = "1" THEN SHELL "i2cset -y 0 0x63 0x0 0x13 b > /dev/null 2>&1" 'backlight ON IF PROGRAMARG$(5) = "0" THEN SHELL "i2cset -y 0 0x63 0x0 0x14 b > /dev/null 2>&1" 'backlight OFF for character_number = 1 to word_length character$ = MID$ (word$, character_number, 1) column$ = HEX$(starting_column + character_number) ' now go to the starting cell SHELL "i2cset -y 0 0x63 0x0 0x03 b > /dev/null 2>&1" SHELL "i2cset -y 0 0x63 0x0 0x0"+line$+" b > /dev/null 2>&1" SHELL "i2cset -y 0 0x63 0x0 0x0"+column$+" b > /dev/null 2>&1" ch$ = "0x" + HEX$(ASC(character$)) SHELL "i2cset -y 0 0x63 0x0 "+ch$+ " b > /dev/null 2>&1" next character_number SYSTEM