Difference between revisions of "Blog 06"

From BitWizard Wiki
Jump to navigation Jump to search
Line 2: Line 2:


Now we will also add the time under the temperature:
Now we will also add the time under the temperature:
Here for we combine the codes together.
For this we will combine the codes together.
We have the previous timer code
For making this I used the previous timer script.
where we remove the other information
Where we remove some information
on the top we put the temperature: 11:00b ( 00 for the first row 11 for display )
On the top we put the temperature: 11:00b ( 00 for the first row 11 for display )
which is connected with the code of; showtimer.
The is connected with the code of; ./showtemp.
and on the second row the timer. ( 11:20b )
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.


I made a new folder called: Koekje
+ with all the files referencing: Koekje.


The name I gave this script is TimeTemp:


#!/bin/bash
#!/bin/bash

# What display to use:
# What display to use:
Koekje="bw_tool -I -D /dev/i2c-1 -a 94"
DISP="bw_tool -I -D /dev/i2c-1 -a 94"
# e.g. for SPI use:
# e.g. for SPI use:
#DISPL="bw_tool -D /dev/spidev1.0 -a 94"
#DISPL="bw_tool -D /dev/spidev1.0 -a 94"
#clean the display
#clean the display
$Koekje -W 10:0:b
$DISP -W 10:0:b
while true; do
while true; do
#get cpu loads
load=`cut -d' ' -f-3 /proc/loadavg`
#show temperature
#show temperature
$Koekje -W 11:00:b
$DISP -W 11:00:b
$Koekje -t "temp: "`./showtemp`
$DISP -t "temp: "`./showtemp`
#print the current time
#print the current time
$Koekje -W 11:20:b
$DISP -W 11:20:b
$Koekje -t `date +%H:%M:%S`
$DISP -t `date +%H:%M:%S`
#idle for 5 seconds
#idle for 5 seconds
sleep 5
sleep 5
Line 35: Line 35:
done
done


./TimeTemp


The result:
./Koekje

[[File:DSC05993TSE.png|400px|thumb|none|This picture was taken on the same moment it changed from time]]
[[File:DSC05993TSE.png|400px|thumb|none|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.
On [[Blog 07]] I am going to use the buttons to print text on the display.

Revision as of 14:14, 16 September 2015

!BETA!

Now we will also add the time under the temperature: 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.