Pages: [1]   Go Down
Author Topic: Retrieving sensor values from Arduino UNO via PHP GET  (Read 598 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!  I have tried pretty much everything I could think of, and Google has not been of much help unfortunately..

Basically, I have built an Arduino UNO based Ethernet thermometer and its working GREAT thanks to the valuable help from this community!

Now I'd like to push the project a bit further and monitor the sensor's output.

As it is now, I can access the ethernet thermometer's webpage and see the sensor's readings so I know the Arduino side of the project is working fine.  I can also store values to a MySQL database fine via a PHP script so this is also working fine.  Its getting the values from the Arduino that is puzzling me.  I have tried several php scripts from the internet but none have been working..

My PHP script:

Code:
<?php
header
('Content-type: text/plain');

$link mysql_connect("localhost""username""password") or die("Cannot login to MySQL server!!: " mysql_error());
mysql_select_db("arduino") or die("Unable to select DB!!");
$query "INSERT INTO temp(temp_string_a, temp_string_b, temp_string_c, temp_string_d, temp_string_e) VALUES ('" $_GET['temp_string_a'] . "', '" $_GET['temp_string_b'] . "','" $_GET['temp_string_c'] . "','" $_GET['temp_string_d'] . "', '" $_GET['temp_string_e'] . "')";$result mysql_query($query) or die("Request failed!!: " mysql_error());

mysql_close($link);
?>


The Arduino sketch (Special Thanks to the devs at code.google.com/p/webduino for their sketch!!!!) is attached to this post because the overall length exceeded the forum's maximum post length


One of the things that worries me (and I think this is pretty normal) is the fact that the PHP code has no mean to retrieve from an ethernet connection...  Nowhere I indicated the device's IP.... I am very useless in PHP programming and in C++ in general so please give me a chance.. smiley-wink

Can anyone help me tie the two ends together and successfully retrieve the sensor's data and store to the MySQL DB?

Thank you!!

* arduino_r00.ino (7.04 KB - downloaded 13 times.)
« Last Edit: May 09, 2013, 09:04:08 pm by lpallard » Logged

Pages: [1]   Go Up
Jump to: