LCD temperature display
The following forum message was posted by g1gsw at http://sourceforge.net/
Here is the updated script which enables setting the sensor names. They are
TEMP to TEMP for a 4 line display.
#!/bin/bash MYLCD='/var/1-Wire/29. C2A909000000' # Get sensor values SENSOR1=`cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^[ t]*//'` SENSOR2=`cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^[ t]*//'` SENSOR3=`cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^[ t]*//'` SENSOR4=`cat /var/1-Wire/10.BC8FF5010800/temperature | sed 's/^[ t]*//'` # screen is 2x40 lines in 4 bit mode LCD1='$MYLCD/LCD_H/screen' # message is 1x80 line in 4 bit mode LCD2='$MYLCD/LCD_H/message' # Sensor values MSG='$SENSOR1' MSG='$SENSOR2' MSG='$SENSOR3' MSG='$SENSOR4' # Sensor names can be whatever you like TEMP='Sensor1' TEMP='Sensor2' TEMP='Sensor3' TEMP='Sensor4' # Initialise the display printf 'x0C' > $LCD1 printf '1' > $MYLCD/LCD_H/clear printf '1' > $MYLCD/LCD_H/home # Print the display lines in the # order 1 3 2 4 for 4 line by 20 # character display as it is 2x40 # in 4 bit mode for INDEX in 1 3 2 4 do printf '%-20s' '$ $' > $LCD1 done
Not very good I am afraid but at least it shows it working. I only have the
one sensor so far but intend to add more once all my parts arrive to build the
boards etc. Glad it may be useful to someone, took me a little while to work
out how to use it as there seems to be very little info available. What it
does is send a reset to the screen then a clear and a home cursor hidden. It
then goes through the 4 sensors defined pads the lines to 20 characters each
using printf and prints the values to the screen. Sensor1 could do with being
a variable once I get some more sensors. I will post the update then.
I forgot to add the display was bought from here for people in the UK