Hi,
Porting a webserver application I wrote to 1.0.6 and Im getting error accessing the Ethernet Class:
Ive gone back to the demo on the EthernetClient documentation - and even this wont work with the same error.
Trying to compile the demo code on this page:
Example
#include <Ethernet.h>
#include <SPI.h>
// the media access control (ethernet hardware) address for the shield:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//the IP address for the shield:
byte ip[] = { 10, 0, 0, 177 };
// the router's gateway address:
byte gateway[] = { 10, 0, 0, 1 };
// the subnet:
byte subnet[] = { 255, 255, 0, 0 };
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup()
{
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
}
void loop()
{
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
server.write(client.read());
}
}
Gives me the following error
sketch_nov13a.ino: In function 'void loop()':
sketch_nov13a:30: error: ambiguous overload for 'operator==' in 'client == 1'
sketch_nov13a.ino:30: note: candidates are: operator==(int, int) <built-in>
C:\SDK\Arduino\IDE\libraries\Ethernet/EthernetClient.h:27: note: virtual bool EthernetClient::operator==(const EthernetClient&)
Seems you cannot do
if (client == true)
anymore
Is there a new way of doing this and the samples havn't been updated?
Also - another issue with the same compiler..
Im getting an error setting a String to null with this compiler that wasnt an issue before
code:
String aString == NULL;
Compiler says:
sketch_nov13a:17: error: conversion from 'int' to 'String' is ambiguous
Easy fix is to set it to "" instead - but can you not set a String to null anymore?
Previously I Used 1.0.5 and all the above compiled just fine in 1.0.5
Thanks ![]()