Blog 06

From BitWizard Wiki
Jump to navigation Jump to search

!BETA!

Now we will also add the time(blog 04) under the temperature(blog 05): For this we will combine the codes together. For making this I used the previous timer script. Where we remove some information On the top we put the temperature: 11:00b ( 00 for the first row 11 for display ) The is connected with the code of; ./showtemp. and on the second row the timer. ( 11:20b ) Where I just used +%H:%M:%S. I could also just use ./Timer, but if I do that I have to remove the load averages of the script.


The name I gave this script is TimeTemp:

#!/bin/bash 

# What display to use: 
DISP="bw_tool -I -D /dev/i2c-1 -a 94" 
# e.g. for SPI use: 
#DISPL="bw_tool -D /dev/spidev1.0 -a 94" 
#clean the display 
$DISP -W 10:0:b 
while true; do 
        #show temperature 
        $DISP -W 11:00:b 
        $DISP -t "temp: "`./showtemp` 

        #print the current time 
        $DISP -W 11:20:b 
        $DISP -t `date +%H:%M:%S` 

        #idle for 5 seconds 
        sleep 5 

done 
./TimeTemp  

The result:

This picture was taken on the same moment it changed from time

On Blog 07 I am going to use the buttons to print text on the display.