HI Everyone
I am trying to build an arduino project that displays "Dhcp information" on a 4 line lcd.
There is a video I have seen on youtube that is exactly what I want,i copied the code and libraries but unsucessfull.The guy who made this project doesn't reply to me and I would like assistance from you Arduino crew please.On the
His link :
The compiler stops at "Socket was not declared"
PLEASE HELP ME
His Code I copied:
#include <SPI.h>
#include <Ethernet.h>
#include <ICMPPing.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};
String ip = "";
String subnetmask = "";
String gateway = "";
String dhcpserver = "";
String dnsserver = "";
SOCKET pingSocket = 0;
char buffer [255];
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
}
void loop() {
lcd.init();
lcd.backlight();
while(1==1) {
EthernetClient client;
lcd.setCursor ( 0, 0 );
lcd.print(" ------------------ ");
lcd.setCursor ( 0, 1 );
lcd.print("| DER GROSSE |");
lcd.setCursor ( 0, 2 );
lcd.print("| MUTATO |");
lcd.setCursor ( 0, 3 );
lcd.print(" ------------------ ");
delay(500);
lcd.setCursor ( 0, 0 );
lcd.print("+------------------+");
lcd.setCursor ( 0, 1 );
lcd.print("| DER GROSSE |");
lcd.setCursor ( 0, 2 ); //
lcd.print("| MUTATO |");
lcd.setCursor ( 0, 3 );
lcd.print("+------------------+");
if(Ethernet.begin(mac,2000,2000) == 1)
{
lcd.clear();
break;
}
client.stop();
}
printIPAddress();
printsubnetmask();
printgateway();
printdnsserver();
while(1 == 1) {
if(ping()==1){
lcd.clear();
break;
}
delay(2000);
}
}
int ping()
{
ICMPPing ping(pingSocket);
byte pingAddr[] = { Ethernet.gatewayIP()[0],Ethernet.gatewayIP()[1],Ethernet.gatewayIP()[2],Ethernet.gatewayIP()[3]};
ping(1, pingAddr, buffer);
char *p = buffer;
char str;
char buffer[20];
int x=0;
while((str = strtok_r(p,"[",&p))!=NULL){
buffer[x]=str;
x++;
}
String checkping= buffer[0];
if(checkping!="Reply")
{
return 1;
}
else
{
return 0;
}
}
void printIPAddress()
{
for (byte thisByte = 0; thisByte < 4; thisByte++) {
ip+=Ethernet.localIP()[thisByte], DEC;
if (thisByte < 3)
{
ip+= ".";
}
}
lcd.setCursor ( 0, 0 );
lcd.print( "IP | " + ip );
ip="";
}
void printsubnetmask()
{
for (byte thisByte = 0; thisByte < 4; thisByte++) {
subnetmask+=Ethernet.subnetMask()[thisByte], DEC;
if (thisByte < 3)
{
subnetmask+= ".";
}
}
lcd.setCursor ( 0, 1 );
lcd.print( "SN | " + subnetmask );
subnetmask="";
}
void printgateway()
{
for (byte thisByte = 0; thisByte < 4; thisByte++) {
gateway+=Ethernet.gatewayIP()[thisByte], DEC;
if (thisByte < 3)
{
gateway+= ".";
}
}
lcd.setCursor ( 0, 2 );
lcd.print( "GW | " + gateway );
gateway="";
}
void printdnsserver()
{
for (byte thisByte = 0; thisByte < 4; thisByte++) {
dnsserver+=Ethernet.dnsServerIP()[thisByte], DEC;
if (thisByte < 3)
{
dnsserver+= ".";
}
}
lcd.setCursor ( 0, 3 );
lcd.print( "DNS| " + dnsserver );
dnsserver="";
}
