Webserver Code - Based on the open-source WiShield library found at https://github.com/asynclabs/WiShield
Also, the graph is created via Google Chart Tools API
#include#define WIRELESS_MODE_INFRA 1 #define WIRELESS_MODE_ADHOC 2 // Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = { 18,250,1,45}; // IP address of WiShield unsigned char gateway_ip[] = { 18,250,1,1}; // router or gateway IP address unsigned char subnet_mask[] = { 255,255,0,0}; // subnet mask for the local network const prog_char ssid[] PROGMEM = { "MIT GUEST"}; // max 32 bytes unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 // setup the wireless mode // infrastructure - connect to AP // adhoc - connect to another WiFi device unsigned char wireless_mode = WIRELESS_MODE_INFRA; unsigned char ssid_len; unsigned char security_passphrase_len; // End of wireless configuration parameters ---------------------------------------- //Temp array (last six readings unsigned int temp[6]={ 0,0,0,0,0,0} // This is our page serving function that generates web pages const prog_char webpage[] PROGMEM = { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" "" " " " " " " " " " " " " " " " " " " "};" boolean sendMyPage(char* URL) { // Check if the requested URL matches "/" if (strcmp(URL, "/") == 0) { // Use WiServer's print and println functions to write out the page content WiServer.print(webpage); // URL was recognized return true; } // URL not found return false; } void setup() { // Initialize WiServer and have it use the sendMyPage function to serve pages WiServer.init(sendMyPage); // Enable Serial output and ask WiServer to generate log messages (optional) Serial.begin(57600); WiServer.enableVerboseMode(true); } void updateTemp(int i){ temp[i]=analogRead(2); } void loop(){ // Run WiServer WiServer.server_task(); if dT>10*60{ //take a measurement every 10 minutes updateTemp(i); i=0?i>6:i++; //update counter dT=0; } delay(10); }WiFi Accessible Temperature Sensor
" "IP: 18.250.1.45
" "Domain: rpi.mit.edu: port:80
" "" "MAS.863
" "