User manual

difficult to remember. When the client is connected, the browser will send a Get-
Request query. This query at least needs to contain the requested page or re-
source (in this case the main page), the protocol used (http 1.1) and the requested
host (www.example.com). Entering the host is important, since several web ad-
dresses may be located on the same server and thus behind the same IP. If you
want to request another page than the home page, replace / e.g. with
/example.html. In addition to the requested sub-page, your browser will send a lot
more information than just the requested resource. Data such as the browser
used, operating system, screen resolution and other things will be submitted. This
permits the server to adjust content. Then the server will send a response that
looks equally complex at first. The header part of the answer contains a lot of addi-
tional information for your browser. The actual website content will come last.
3.2 | An Internet clock
This project uses the knowledge from the previous chapters to make the NanoESP
independently collect information from a website. The program specifically loads
the current time from a dedicated website and thus sets the internal clock of the
controller that is implemented by library to permit an accurate time indication. The
time will be output via the serial monitor. You only need the board for this setup.
The program
While the previous program still required mostly manual operation, this one pro-
gram works mostly autonomously. The controller connects to the website entirely
independently:
http://chronic.herokuapp.com/
The URL can be used to call various time systems and time zones. The current
time valid in Germany in winter is queried by the URL
http://chronic.herokuapp.com/utc/in-one-hour
. Therefore, the call of the function
getTime() has the second parameter utc/in-one-hour. Based on the UTC (coordi-
nated world time), you need to change the call to utc/in-two-hours in summer. You
can treat all other time zones according to the same system.
The determined time is now handed over to the Time-Library of Michael Margolis
(source: http://www.pjrc.com/teensy/td_libs_Time.html). For practical reasons, a
copy of the Time-Library version that I use is enclosed in the sketch folder. It must
be copied into the libraries folder of your sketchbook folder. In the background, the
new time is continually calculated and output in the terminal every second. You
can simply program an alarm clock or another time-controlled application. For
calling of the time to work, a new function must be used:
boolean getTime(String Host, String Subpage)