Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface HttpServer SDFileSystem mbed-rpc mbed-rtos mbed
Fork of IoTKit_HttpServer by
Diff: main.cpp
- Revision:
- 0:050a5d4ffd55
- Child:
- 3:5758cfefe980
diff -r 000000000000 -r 050a5d4ffd55 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Feb 20 05:37:05 2014 +0000
@@ -0,0 +1,40 @@
+//#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */
+#define __DEBUG
+#include "mbed.h"
+#include "rtos.h"
+#include "EthernetInterface.h"
+#include "HTTPServer.h"
+
+EthernetInterface eth;
+DigitalOut led1(LED1);
+
+void aliveState(void const *args) {
+ while (true) {
+ led1 = !led1;
+ Thread::wait(1000);
+ }
+}
+
+int main()
+{
+ printf("********* PROGRAM START ***********\r\n");
+ Thread thread(aliveState);
+ printf("EthernetInterface Setting up...\r\n");
+ if(eth.init()!=0) { //for DHCP Server
+ //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address
+ printf("EthernetInterface Initialize Error \r\n");
+ return -1;
+ }
+ if(eth.connect()!=0) {
+ printf("EthernetInterface Connect Error \r\n");
+ return -1;
+ }
+ printf("IP Address is %s\r\n", eth.getIPAddress());
+ printf("NetMask is %s\r\n", eth.getNetworkMask());
+ printf("Gateway Address is %s\r\n", eth.getGateway());
+ printf("Ethernet Setup OK\r\n");
+
+ HTTPServerAddHandler<SimpleHandler>("/"); //Default handler
+ HTTPServerStart(80);
+}
+
