Created
November 19, 2012 18:45
-
-
Save cieslak/4112791 to your computer and use it in GitHub Desktop.
Revisions
-
cieslak revised this gist
Nov 19, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ You need: - Arduino - Ethernet Shield - Sparkfun Serial LCD Kit - Webduino library https://github.com/sirleech/Webduino - Buzzer (optional) Hook up: -
cieslak created this gist
Nov 19, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ You need: - Arduino - Ethernet Shield - Sparkfun Serial LCD Kit - Buzzer (optional) Hook up: - Ethernet shield to Arduino - LCD: 5V and ground, serial to pin 3 - Buzzer: connect to pin 6 and ground Change the MAC address var in the code to match your shield's MAC, and assign it a valid IP address for your network. That's it. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #include "SPI.h" #include "Ethernet.h" #include "WebServer.h" #include "SoftwareSerial.h" static uint8_t mac[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // change this to your Ethernet shield's MAC address static uint8_t ip[] = { 192, 168, 1, 2 }; // change to your network #define PREFIX "" WebServer webserver(PREFIX, 80); SoftwareSerial lcd(2,3); void showForm(WebServer &server, WebServer::ConnectionType type, char *, bool) { server.httpSuccess(); if (type != WebServer::HEAD) { if (type == WebServer::POST) { P(thxMsg) = "<!doctype HTML><html><body>Thanks!</body></html>"; server.printP(thxMsg); bool repeat; char name[16],value[32]; do { repeat = server.readPOSTparam(name,16,value,32); if (strcmp(name,"msg") == 0) { lcd.write(0xFE); lcd.write(0x01); lcd.print(value); tone(6,600,1000); } } while (repeat); } else { P(formMsg) = "<!doctype HTML><html><body><form name=\"input\" action=\"/\" method=\"post\"><input type=\"text\" name=\"msg\"><input type=\"submit\" value=\"send\"></form></body></html>"; server.printP(formMsg); } } } void setup() { Ethernet.begin(mac, ip); lcd.begin(9600); webserver.setDefaultCommand(&showForm); webserver.begin(); } void loop() { char buf[64]; int len = 64; webserver.processConnection(buf, &len); }