newest version
Diff: Networkbits.cpp
- Revision:
- 9:ca8090c7868e
- Parent:
- 8:df979097cc71
--- a/Networkbits.cpp Thu Dec 07 15:28:16 2017 +0000 +++ b/Networkbits.cpp Fri Dec 07 13:07:08 2018 +0000 @@ -1,11 +1,12 @@ #include "sample_hardware.hpp" #include "Networkbits.hpp" +#include "ntp-client/NTPClient.h" //Network thread - responsible for listening for connectinos and responding with updated tempature values void networktest() { //This only runs when BOTH switches are pressed down - if ((SW1 == 0) || (SW2 == 0)) return; + if (SW2 == 0) return; lcd.cls(); lcd.printf("Basic HTTP server example\n"); @@ -16,6 +17,8 @@ eth.connect(); lcd.printf("The target IP address is '%s'\n", eth.get_ip_address()); + NTPClient ntp(ð); + //Now setup a web server TCPServer srv; //TCP/IP Server TCPSocket clt_sock; //Socket for communication @@ -31,7 +34,7 @@ srv.listen(5); //KEEP RESPONDING WHILE THE SWITCHES ARE PRESSED - while ((SW1 == 1) && (SW2 == 1)) { + while (SW2 == 1) { using namespace std; lcd.cls(); lcd.printf("Open 10.0.0.1 in a browser\n"); @@ -63,6 +66,6 @@ printf("Release BOTH switches\n"); lcd.printf("Release BOTH switches\n"); - while ((SW1 != 0) && (SW2 != 0)); + while (SW2 != 0); wait(0.5); //debounce } \ No newline at end of file