Hardware Reference
In-Depth Information
Your Galileo can use its Internet connection via Ethernet or WiFi to connect
to this URL, take the data it receives, and evaluate how to display it (see
Figure 6-3
). First, let's make sure it can connect to the server.
1. Walk through the instructions in
“Connecting and Testing an Ethernet
Connection” on page 104
or
“Connecting and Testing with a WiFi Con-
nection” on page 105
to make sure you have connectivity to the Internet.
2. Create a new sketch and enter the code from
Example 6-3
.
3. Upload the code and then open the serial monitor.
Figure 6-3.
Galileo has many ways to connect physical objects to the Inter-
net!
In the serial monitor, you should see a number printed every five seconds.
This number represents the number of hours until the next issue of MAKE is
released (in case you want to be more precise!).
Example 6-3. Getting simple data from the Internet
void
setup
()
{
Serial
.
begin
(
9600
);
}
void
loop
()
{
Serial
.
println
(
getHours
());
//
delay
(
5000
);