This shows you the differences between two versions of the page.
iotcluj:labs:07 [2016/07/14 11:59] ioana_maria.culic [Use HTML to create a web page] |
iotcluj:labs:07 [2016/07/14 12:42] (current) ioana_maria.culic [Exercises] |
||
---|---|---|---|
Line 57: | Line 57: | ||
What the server does is to generate a random number every one second and store it in the **random** variable. | What the server does is to generate a random number every one second and store it in the **random** variable. | ||
- | The other stream of nodes sets the route to **/** and responds with a html template. The **template** node returns the html code which the **Web response** node will return to the client. | + | The other stream of nodes sets the route to / and responds with a html template. The **template** node returns the html code which the **Web response** node will return to the client. |
The **template** note generates the following html page: | The **template** note generates the following html page: | ||
{{ :iotcluj:labs:template.png?400 |}} | {{ :iotcluj:labs:template.png?400 |}} | ||
- | Notice that the random variable is accessed and the structure {{ random }} will be replaced with the variable's value. | + | Notice that the random variable is accessed and the structure { { random } } will be replaced with the variable's value. |
==== Dynamic web pages ==== | ==== Dynamic web pages ==== | ||
Line 94: | Line 94: | ||
- Write a web server and show to the user a static html page. If he requests anything else that that page, show him an error page. | - Write a web server and show to the user a static html page. If he requests anything else that that page, show him an error page. | ||
- Build a web service that allow controlling the device pins. (Hint: without any html page, just write the links in the browser) | - Build a web service that allow controlling the device pins. (Hint: without any html page, just write the links in the browser) | ||
- | - Write a web page to test the service. | + | - /pin?mode=read&pin=pin_number |
+ | - /pin?mode=write&pin=pin_number&value=value | ||
+ | - Extend the service for the Arduino pins also with /arduino/digital/pin and /arduino/analog/pin | ||
+ | - Write a web page to test the service. (Hint: for writing values use html forms with method GET, read about them) | ||
- Write a web server that shows the user the temperature on each refresh. (Hint: use the template node) | - Write a web server that shows the user the temperature on each refresh. (Hint: use the template node) | ||
- Write a web server that shows the user the temperature without refresh. (Hint: use the web html node) | - Write a web server that shows the user the temperature without refresh. (Hint: use the web html node) | ||
- Add a select box to the page, so that the user can select what he wants to see: the temperature or the light. | - Add a select box to the page, so that the user can select what he wants to see: the temperature or the light. | ||