Build a long-term datalogging system. Capture data from the physical world in a database and build a web interface to display the data gathered over time.
CREATE TABLE NetworkDataLogging (
Value INT NOT NULL,
Date DATE NOT NULL,
Timestamp TIME NOT NULL
);
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
}
void loop()
{
// wait 10 seconds before sending data
delay(10000);
// read analog input
sensorValue = analogRead(0);
// connect to the web server. should be IP address.
Serial.print("C147.46.xxx.xxx/80\n");
// send data via GET method of HTTP request
Serial.print("GET /~risknfun/sensor.php?action=insert&sensorValue=");
Serial.print(sensorValue);
Serial.print(" HTTP/1.1\n");
Serial.print("HOST: itp.nyu.edu\n\n");
}
333 2007-02-28 13:35:41
333 2007-02-28 13:35:51
137 2007-02-28 13:36:01
137 2007-02-28 13:36:11
137 2007-02-28 13:36:21
0 2007-02-28 13:38:51
106 2007-02-28 13:39:01
106 2007-02-28 13:39:11
106 2007-02-28 13:39:21
106 2007-02-28 13:39:31
0 2007-02-28 13:39:41
926 2007-02-28 13:39:51
926 2007-02-28 13:40:01
926 2007-02-28 13:40:11