Display Continues Ping

How to display continues ping to cloud.blynk.cc:8442 in LCD widget ?
Thanks…

this my code…

**#define BLYNK_PRINT Serial**
**#include LiquidCrystal.h**
**#include SPI.h**
**#include Ethernet.h**
**#include ICMPPing.h**
**#include BlynkSimpleEthernet.h**

LiquidCrystal lcd(8, 3, 9, 4, 5, 6, 7); // these are the pins used on the shield for this sketch
unsigned long start, finished, elapsed;

//byte mac[] = {0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED}; // max address for ethernet shield
//byte ip[] = {10, 10, 0, 75}; // ip address for ethernet shield
IPAddress pingAddr(45,55,195,102); // ip address to ping
char auth[] = "9d13cddba3d8450ca7e8badf586f4ee3";
SOCKET pingSocket = 0;

char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

const unsigned long interval = 300;
const unsigned long interval1 = 200;
const unsigned long interval2 = 100;
unsigned long timer;
unsigned long timer1;
unsigned long timer2;

IPAddress server_ip (45,55,195,102);
// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 10,   0,   0,  75);
IPAddress dns_ip     (  8,   8,   8,   8);
IPAddress gateway_ip ( 10,   10,   0,   1);
IPAddress subnet_mask(255, 255, 255,   0);
void setup() {

  Serial.begin(9600);
  Blynk.begin(auth);
  lcd.begin(16, 2);
  //Print default title.
  clearPrintTitle();
  delay(2000);
}

void loop() {
  //Call the main menu.

  if ( (millis () - timer) >= interval)
    Blynk.run();
    uptime();
  if ( (millis () - timer1) >= interval1)
   pingss();
 // if ( (millis () - timer2) >= interval2)
 // uptime();
}
//Print a basic header on Row 1.
void clearPrintTitle() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" HACKSHED.CO.UK ");
  lcd.setCursor(0, 1);
  lcd.clear();
}

void pingss()
{
  ICMPEchoReply echoReply = ping(pingAddr, 4);
  if (echoReply.status == SUCCESS)
  {
    lcd.setCursor(0, 0);
    lcd.print("Ping: ");
    lcd.print(millis() - echoReply.data.time);
    lcd.print("ms");
    delay(1000);
  }

  else
  {
    lcd.setCursor(0, 0);
    lcd.print(echoReply.status);
    delay(1000);
  }

}

void uptime()
{
  finished = millis(); // saves stop time to calculate the elapsed time
  //delay(200); // for debounce

  //  lcd.setCursor(0,0); // NOT needed

  displayResult(); // display the results on the function}
}
void displayResult()
{
  // declare variables
  float h, m, s ;
  unsigned long over;

  // MATH time!!!
  elapsed = finished - start;

  h = int(elapsed / 3600000);
  over = elapsed % 3600000;
  m    = int(over / 60000);
  over = over % 60000;
  s    = int(over / 1000);



  // display the results
  lcd.setCursor(0, 1);
  // display variable 'h' - the 0 after it is the number of algorithms after a comma
  //(ex: lcd.print(h, 2); would print 0,00
  lcd.print("Up  : ");
  lcd.print(h, 0);
  lcd.print("h "); // and the letter 'h' after it
  lcd.print(m, 0);
  lcd.print("m ");
  lcd.print(s, 0);
  lcd.print("s ");

}
1 Like

Try to remove delays in pingss