Ethernet to Server
Writing temperature and light values to a storage file.
http://www.piuggi.com/sensorData/storage.txt
Php Script
put this script on your server which supports php.
<html><body>
<?php
$light = $_GET['sendLight']; $temp = $_GET['sendTemp'];
$test_string = sprintf("We work work work work work work work, the whole day through...");
//print the date
$day = date('m/d');
//print the time
$time = date('H:i:s');
//format them into an xml style
$data = sprintf("\n<entry> \n <day>%s</day> \n <time> %s </time> \n <light> %s </light> \n <temp> %s </temp> \n</entry>\n",$day, $time , $light, $temp);
//tell the server which file to open
$filename = "storage.txt";
//command it to open in order to append
$file = fopen($filename,"a");
//write our data string...
fwrite($file, $data);
//and we out.
fclose($file); ?>
<p> <?php echo $test_string ?> </p>
</body>
</html>
Arduino Side of things
Download here >












scottpeterman 1:40 am on March 11, 2011 Permalink |
Thanks!!!! Super helpful, the mac seems to be pretty weird with direct fwrite/fread to the arduino over serial (plus a lot of user error as well I’m sure), I kinda want to just pick one of these up…