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: mbed
Fork of webserverBlinky by
Diff: main.cpp
- Revision:
- 136:28a838086979
- Parent:
- 135:6c3eec2fa634
- Child:
- 137:eda0cfcf4d3c
--- a/main.cpp Wed Aug 16 11:56:14 2017 +0000 +++ b/main.cpp Wed Aug 16 22:27:46 2017 +0000 @@ -31,10 +31,12 @@ // in the above command 172.10.10.1 is the adapter IP, and 172.10.10.2 is the IP of PPP-Blinky. // See also https://en.wikipedia.org/wiki/Point-to-Point_Protocol_daemon -// Special pages in PPP-Blinky +// Special pages when PPP-Blinky is running +// 172.10.10.2 root page // 172.10.10.2/x returns a number that increments every time you request a page - this is handy for testing -// 172.10.10.2/xb also returns a number, but issues a fast refresh command. This allows you to use your browser to benchmark page load speed -// 172.10.10.2/ws brings up a simple websocket demo +// 172.10.10.2/xb also returns a number, but issues a fast refresh command. This allows you to use your browser to benchmark page load speed +// 172.10.10.2/ws a simple WebSocket demo +// http://jsfiddle.net/d26cyuh2/ more complete WebSocket demo in JSFiddle // Ok, enough talking, time to check out some code!! @@ -95,15 +97,16 @@ x().textContent=parseInt(x().textContent)+1;},100);};\ </script>\ </head>\ -<body style=\"font-family: sans-serif; font-size:25px; color:#807070\">\ +<body style=\"font-family: sans-serif; font-size:20px; color:#807070\">\ <h1>mbed PPP-Blinky Up and Running</h1>\ <h1 id=\"w\" style=\"text-align:center;\">0</h1>\ <h1><a href=\"http://bit.ly/pppBlink2\">Source on mbed</a></h1>\ <h1><a href=\"/ws\">WebSocket Demo</a></h1>\ <h1><a href=\"/x\">Benchmark 1</a></h1>\ <h1><a href=\"/xb\">Benchmark 2</a></h1>\ +<h1><a href=\"http://jsfiddle.net/d26cyuh2/\">JSFiddle Demo</a></h1>\ </body>\ -</html>"; // 460 characters plus 1 null byte = 461 +</html>"; // size = 642 bytes plus 1 null byte = 643 bytes const static char webSocketPage[] = "\ <!DOCTYPE html>\ @@ -140,7 +143,7 @@ <button id=\"btn\" style=\"font-size: 100%; margin-top: 55px; margin-bottom: 55px;\">Connect</button>\ <h4><a href=\"/\">PPP-Blinky home</a></h4>\ </body>\ -</html>"; +</html>"; // size = 916 bytes + 1 null byte = 917 bytes // The serial port on your mbed hardware. Your PC should be configured to view this port as a standard dial-up networking modem. // On Windows the model type of the modem should be selected as "Communications cable between two computers" @@ -1171,7 +1174,7 @@ pc.baud(115200); // USB serial port to pc debugBaudRate(115200); // baud rate for our (optional) debug port debugPrintf("\x1b[2J\x1b[H\x1b[30mmbed PPP-Blinky HTTP & WebSocket server ready :)\n"); // VT100 codes for clear_screen, home, black_text - Tera Term is a handy VT100 terminal - + pppInitStruct(); // initialize all the PPP properties while(1) { scanForConnectString(); // wait for connect from PC dial-up networking