University of Essex CE713

Dependencies:   mbed HTTPServer EthernetNetIf TextLCD

Fork of HTTPServerHelloWorld by Robert Gutknecht

Revision:
8:b6a76cc9c872
Parent:
7:7f4d940077bd
diff -r 7f4d940077bd -r b6a76cc9c872 main.cpp
--- a/main.cpp	Thu Nov 30 15:51:11 2017 +0000
+++ b/main.cpp	Thu Nov 18 15:38:21 2021 +0000
@@ -41,13 +41,13 @@
 
 void WebServerPoll () {
     Net::poll();                                      // bump web server into action
-    led1=!led1;                                       // show that we are alive
+    led1=!led1;                                       // show that web server polling is alive
 }
 
 int InitWebServer() {
   EthernetErr ethErr = eth.setup();
   if(ethErr) {
-    return -1;
+    return -1;                                        // ethernet setup error
   }
   FILE *fp = fopen("/webfs/index.htm", "w");          // open "out.txt" on the local file system for writing
   fprintf(fp, "<html><head><title>Hello World online</title></head><body><h1>Hello World from Mbed NXP LPC1768!</h1></body></html>");
@@ -297,8 +297,8 @@
         lcd.printf("Key = %c\n", Key);                // print result
         wait(1);                                      // wait 1 second
         lcd.cls();                                    // clear lcd
-        int dist = ReadSonar();                       // get distance
-        lcd.printf("Distance = %d\n", dist);          // print result
+//        int dist = ReadSonar();                       // get distance
+//        lcd.printf("Distance = %d\n", dist);          // print result
         lcd.printf("Servo = %f\n", spos);             // print servo pos
         wait(1);                                      // wait 1 second
         ReadMotion();                                 // read new data in from the MPU-6050
@@ -324,8 +324,8 @@
         }                                             //
         Servo1(spos);                                 // update servo
         // HTTPText("<html><head><title>Hello World online</title></head><body><h1>New Message !!!!</h1></body></html>");
-        char Buffer[100];
-        sprintf(Buffer, "<html><head><title>Hello World online</title></head><body><h1> Temperature = %.3f %s", temp, "</h1></body></html>");
+        char Buffer[200];
+        sprintf(Buffer, "%s %.3f %s %1.1f %s", "<html><head><title>Hello World online</title></head><body><h1> Temperature = ", temp, "<br/>Servo = ", spos, "</h1></body></html>");
         HTTPText(Buffer);                             // ouput temperature on web page 
     }
 }