Network, SD card, Serial, LCD and sensors all work! :) ** Don't Press the User Button without an SD Card inserted!! **

Dependencies:   BMP280

Fork of Thread_Communication_V2 by BDG

Revision:
9:b838c5787ed7
Parent:
8:ab6322afa341
Child:
10:c10d1337d754
diff -r ab6322afa341 -r b838c5787ed7 main.h
--- a/main.h	Fri Dec 29 17:50:30 2017 +0000
+++ b/main.h	Sat Dec 30 15:12:09 2017 +0000
@@ -11,6 +11,43 @@
 #define ON 1
 #define OFF 0
 
+#if !FEATURE_LWIP
+    #error [NOT_SUPPORTED] LWIP not supported for this target
+#endif
+
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "TCPServer.h"
+#include "TCPSocket.h"
+#include <iostream>
+#include <string> 
+
+#define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
+#define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
+#define HTTP_MESSAGE_BODY1 ""                                    \
+"<html>" "\r\n"                                                  \
+"  <body style=\"display:flex;text-align:center\">" "\r\n"       \
+"   <meta http-equiv=\"refresh\" content=\"1; \"\> " "\r\n"        \
+"    <div style=\"margin:auto\">" "\r\n"                         \
+"      <h1>Sensor Data</h1>" "\r\n"                              \
+"      <p> LDR: "                                                \
+
+#define HTTP_MESSAGE_BODY2 ""                                    \
+       "</p>" "\r\n"                                             \
+"    </div>" "\r\n"                                              \
+"  </body>" "\r\n"                                               \
+"</html>"
+
+#define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n"   \
+                      HTTP_HEADER_FIELDS "\r\n" \
+                      "\r\n"                    \
+                      HTTP_MESSAGE_BODY "\r\n"
+
+#define IP        "10.0.0.10"
+#define NETMASK   "255.0.0.0"
+#define GATEWAY   "10.0.0.1"
+
+
 extern LCD lcd;
 extern BMP280 sensor;
 extern SDBlockDevice sd (PB_5, D12, D13, D10);