Day 15: Light sensor
Today’s project does not use the web server’s website as a control interface, but as an output element. The brightness measured via a brightness sensor is displayed well-structuredly as a relative value.
Behind today’s door, there is another photo transistor that serves as a light sensor. The photo transistor looks like an LED, but should not be mistaken for one. The structure of today’s experiment is shown in the figure. The collector of the photo transistor is the shorter connection. It is applied to +5 V.
The program: Day15_TCPServerBright
Until now, the websites of the webserver were always made up of an unchangeable page that sent data to the controller. Today, the website is to be changed before being transmitted to the browser, to display the appropriate brightness of the photo transistor. This works because the source code of the website holds a kind of placeholder. The program now replaces the placeholder *bright* when loading the data from the Progmem variable by the current brightness value. Thus, the output text and the deflection of the slider are changed. Another line in the HTML file ensures that the page will reload automatically every few seconds. The current brightness is already displayed well-structuredly in the browser.
The website of the brightness sensor