If you’re trying to use any of the Ethernet examples or the Wifi example straight from the 2nd edition of Making Things Talk, you’re probably getting some errors related to the definition of Client and Server. Here’s how to fix them.
For Arduino 1.0-rc1 and beyond there are new abstract Client and Server classes for both the Ethernet boards and shields and the coming Wifi shields. To accommodate this, the Ethernet client class is now called EthernetClient, and the Ethernet server class is called EthernetServer. Likewise the wifi client class is called WiFiClient and the wifi server class is WiFiServer. This means that you should change your class declarations. For example, what used to be
Client client;
is now
EthernetClient client;
and
Server server(80);
would now be
EthernetServer server(80);
Similarly for WiFi:
Client client;
is now
WiFiClient client;
and
Server server(80);
would now be
WiFiServer server(80);
The rest of your code should remain unchanged and still compile.
The examples in the book affected by this are as follows:
Chapter 4
Chapter 5
Chapter 6
Chapter 9
Chapter 10
The code on my GitHub site for all of these examples is up to date with Arduino 1.0-rc1.
Post a Comment
You must be logged in to post a comment.