hello all friends
I arduino user from thailand. I am a newbie about arduino ( and C++ ) I use Eternet shield "ENC28j60" + Arduino board "ATmega328"
Now I try to programming command MCU send ICMP echo request from destination IP and Check Replay from Destination but not work...
All my friend please help me how to resolve problem please see below code where is wrong why not work. when i compile this code have error message "'class EtherShield has no member named 'ES_packetloop_icmp_checkreply'" but when i open files EtherShield.h I can see this class...
plese help me for this topic
- how to send icmp echo ping request to destination ip ( please show exam code )
- how to check replya echo icmp from destination ip ( please show exam code )
============ My Source Code =====
#include "etherShield.h"
#define INPUT_PIN 0
static uint8_t mymac[6] = {
0x54,0x55,0x58,0x10,0x00,0x25};
static uint8_t myip[4] = {
172,31,141,100};
static uint8_t destip[4] = {172,30,15,135};
static uint8_t websrvip[4] = {
172,30,15,135};
#define WEBSERVER_VHOST "twitter.com"
static uint8_t gwip[4] = {
172,31,140,1};
#define MYWWWPORT 80
static volatile uint8_t start_web_client=0; // 0=off but enabled, 1=send tweet, 2=sending initiated, 3=twitter was sent OK, 4=diable twitter notify
static uint8_t contact_onoff_cnt=0;
static uint8_t web_client_attempts=0;
static uint8_t web_client_sendok=0;
static uint8_t resend=0;
int buttonState; // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin
long lastDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 200; // the debounce time, increase if the output flickers
#define BUFFER_SIZE 250
#define DATE_BUFFER_SIZE 30
static char datebuf[DATE_BUFFER_SIZE]="none";
static uint8_t buf[BUFFER_SIZE+1];
EtherShield es=EtherShield();
int ledPin13 = 13;
void setup(){
pinMode(ledPin13, OUTPUT);
/initialize enc28j60/
es.ES_enc28j60Init(mymac);
//init the ethernet/ip layer:
es.ES_init_ip_arp_udp_tcp(mymac,myip,MYWWWPORT);
// init the web client:
es.ES_client_set_gwip(gwip); // e.g internal IP of dsl router
es.ES_client_set_wwwip(websrvip);
}
void loop(){
uint16_t dat_p;
int8_t cmd;
start_web_client=1;
// send icmp ping
es.ES_client_icmp_request(buf,destip);
delay(2000);
// end send icmp ping
dat_p=es.ES_packetloop_icmp_checkreply(buf,es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf));
//dat_p=es.ES_packetloop_icmp_tcp(buf,es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf));
if(dat_p==0){
digitalWrite(ledPin13, LOW);
delay(2000);
}
if(dat_p!=0)
{
digitalWrite(ledPin13, HIGH);
delay(2000);
}
delay(5000);
===================
Best Regards for All my friends
Newbie Arduino From THAILAND