Difference between revisions of "Raspberry Pi LCD program"

From BitWizard Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:

== Download ==

download the program source from http://www.bitwizard.nl/software/bw_lcd.c

You will need a kernel with spidev enabled and the raspberry pi SPI driver included. See [[Raspberry pi spi kernel]]

This program works well with the rpi_serial board http://www.bitwizard.nl/catalog/product_info.php?cPath=25&products_id=69 and the spi_lcd board: http://www.bitwizard.nl/catalog/product_info.php?products_id=89 .

== Command line arguments ==
== Command line arguments ==


Line 15: Line 24:
-C clearscreen
-C clearscreen
-f <file> display text from file (not implemented yet).
-f <file> display text from file (not implemented yet).

general bw SPI options:
-r <reg>
-v <val> set register to value. Requires -r.


== Example commands ==
== Example commands ==


Print current date on line 0:
Print current date on line 0:
LCD -p 0,0 -t `date +%m/%d/%Y`
bw_lcd -p 0,0 -t `date +%m/%d/%Y`
Print the text "Hello World" on line 1, character 2:
Print the text "Hello World" on line 1, character 2:
LCD -T 2,1 "Hello World"
bw_lcd -T 2,1 "Hello World"
Print the contents of "textfile":
Print the contents of "textfile":
LCD -f textfile
bw_lcd -f textfile
Write two different strings to two daisy-chained displays:
Write two different strings to two daisy-chained displays:
LCD -a 82 -T 0,0 display0
bw_lcd -a 82 -T 0,0 display0
LCD -a 84 -T 0,0 display1
bw_lcd -a 84 -T 0,0 display1

My Pi runs the following script every minute:
#! /bin/sh
./bw_lcd -a 80 -C
./bw_lcd -a 82 -C
./bw_lcd -a 80 -T 0,0 'My wlan0 IP is'
./bw_lcd -a 80 -T 0,1 `/sbin/ifconfig wlan0 | sed '/inet\ /!d;s/.*r://g;s/\ .*//g'`
./bw_lcd -a 82 -T 0,0 'My eth0 IP is'
./bw_lcd -a 82 -T 0,1 `/sbin/ifconfig eth0 | sed '/inet\ /!d;s/.*r://g;s/\ .*//g'`
This prints the IP addresses of both network interfaces on my two displays.

Latest revision as of 11:45, 11 November 2015

Download

download the program source from http://www.bitwizard.nl/software/bw_lcd.c

You will need a kernel with spidev enabled and the raspberry pi SPI driver included. See Raspberry pi spi kernel

This program works well with the rpi_serial board http://www.bitwizard.nl/catalog/product_info.php?cPath=25&products_id=69 and the spi_lcd board: http://www.bitwizard.nl/catalog/product_info.php?products_id=89 .

Command line arguments

 SPI options: 
 -D <device>       SPI device to use. default: /dev/spidev0.0
 -s <speed>        speed to use on the SPI bus default 0.5MHz. 
 -d <delay>        delay between bytes. default: 15 us. 
 LCD options:
 -a <addr>          address of display, defaults to 0x82
 -p <c>,<l>         Jump to line <l> and character <c>
 -t <text>          print text
 -T <c>,<l> <text>  Print tekst starting at line <l> character <c>. 
 -b < b >           Adjust backlight level
 -c <c>             Adjust contrast
 -C                 clearscreen 
 -f <file>          display text from file (not implemented yet).
 general bw SPI options: 
 -r <reg>           
 -v <val>           set register to value. Requires -r.

Example commands

Print current date on line 0:

bw_lcd -p 0,0 -t `date +%m/%d/%Y`

Print the text "Hello World" on line 1, character 2:

bw_lcd -T 2,1 "Hello World"

Print the contents of "textfile":

bw_lcd -f textfile

Write two different strings to two daisy-chained displays:

bw_lcd -a 82 -T 0,0 display0
bw_lcd -a 84 -T 0,0 display1

My Pi runs the following script every minute:

#! /bin/sh

./bw_lcd -a 80 -C
./bw_lcd -a 82 -C
./bw_lcd -a 80 -T 0,0 'My wlan0 IP is'
./bw_lcd -a 80 -T 0,1 `/sbin/ifconfig wlan0 | sed '/inet\ /!d;s/.*r://g;s/\ .*//g'`
./bw_lcd -a 82 -T 0,0 'My eth0 IP is'
./bw_lcd -a 82 -T 0,1 `/sbin/ifconfig eth0 | sed '/inet\ /!d;s/.*r://g;s/\ .*//g'`

This prints the IP addresses of both network interfaces on my two displays.