echo `/root/digitemp-3.3.2/digitemp_DS9097 -a -s /dev/ttyS1` | tail -n 1 -
pisne:
echo `/root/digitemp-3.3.2/digitemp_DS9097 -a -s /dev/tty
DigiTemp v3.3.2 Copyright 1996-2004 by Brian C. Lane GNU Public License v2.0 - http://www.brianlane.com May 10 15:21:20 Sensor 0 C: 16.81 F: 62.26
[/color]
/root/digitemp-3.3.2/digitemp_DS9097 --help
pisne
/root/digitemp-3.3.2/digitemp_DS9097 --help
/root/digitemp-3.3.2/digitemp_DS9097: invalid option -- -
DigiTemp v3.3.2 Copyright 1996-2004 by Brian C. Lane
GNU Public License v2.0 - http://www.brianlane.com
Compiled for DS9097
Usage: digitemp [-s -i -U -l -r -v -t -a -d -n -o -c]
-i Initalize .digitemprc file
-w Walk the full device tree
-s /dev/ttyS0 Set serial port
-l /var/log/temperature Send output to logfile
-c digitemp.conf Configuration File
-r 1000 Read delay in mS
-v Verbose output
-t 0 Read Sensor #
-q No Copyright notice
-a Read all Sensors
-d 5 Delay between samples (in sec.)
-n 50 Number of times to repeat
0=loop forever
-A Treat DS2438 as A/D converter
-O"counter format string" See description below
-o 2 Output format for logfile
-o"output format string" See description below
-H"Humidity format string" See description below
Logfile formats: 1 = One line per sensor, time, C, F (default)
2 = One line per sample, elapsed time, temperature in C
3 = Same as #2, except temperature is in F
#2 and #3 have the data seperated by tabs, suitable for import
into a spreadsheet or other graphing software.
The format string uses strftime tokens plus 5 special ones for
digitemp - %s for sensor #, %C for centigrade, %F for fahrenheit,
%R to output the hex serial number, and %N for seconds since Epoch.
The case of the token is important! The default format string is:
"%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F" which gives you an
output of: May 24 21:25:43 Sensor 0 C: 23.66 F: 74.59
The counter format string has 2 special specifiers:
%n is the counter # and %C is the count in decimal.
The humidity format uses %h for the humidity in percent
[/color]
Mam dva soubory teplota.txt a uloz_teplotu.php
teplota.txt mam na 777
uloz_teplotu.php
<?php
$cmd = "echo `/root/digitemp-3.3.2/digitemp_DS9097 -a -s /dev/ttyS1` | tail -n 1 -";
$data = shell_exec($cmd);
//možná nějak oříznout výstup...
$fp = fopen ("/home/s/www/teplota.txt", "w+"); //potřeba upravit cestu
fwrite($fp, $data);
$fclose($fp);
?>
[/color]
Na strance se mi zobrazi:
teplota.txt
DigiTemp v3.3.2 Copyright 1996-2004 by Brian C. Lane GNU Public License v2.0 - http://www.brianlane.com
[/color]
uloz_teplotu.php
Fatal error: Function name must be a string in /home/s/www/uloz_teplotu.php on line 7
Ale co je divné že mi nechytá druhé čidlo, na druhý com port se nedostanu