Ошибка ==> no matching function for call to 'ICMPPing::ICMPPing(SOCKET&, uint16_t)'
- Войдите на сайт для отправки комментариев
Пт, 10/02/2017 - 13:58
Пытаюсь залить скетч для пинга IP адреса в сети.
#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 ");
}
______________________________________________________________________________________
Выдает ошибку:
Arduino: 1.6.12 (Windows 7), Плата:"Arduino/Genuino Uno"
sketch_feb10a:18: error: no matching function for call to 'ICMPPing::ICMPPing(SOCKET&, uint16_t)'
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));
^
C:\Users\1\AppData\Local\Temp\arduino_modified_sketch_371941\sketch_feb10a.ino:18:51: note: candidates are:
In file included from C:\Users\1\AppData\Local\Temp\arduino_modified_sketch_371941\sketch_feb10a.ino:5:0:
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:28:2: note: ICMPPing::ICMPPing(SOCKET)
ICMPPing(SOCKET s); // construct an ICMPPing object for socket s
^
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:28:2: note: candidate expects 1 argument, 2 provided
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:25:7: note: constexpr ICMPPing::ICMPPing(const ICMPPing&)
class ICMPPing
^
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:25:7: note: candidate expects 1 argument, 2 provided
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:25:7: note: constexpr ICMPPing::ICMPPing(ICMPPing&&)
C:\Program Files (x86)\Arduino\libraries\ICMPPing/ICMPPing.h:25:7: note: candidate expects 1 argument, 2 provided
C:\Users\1\AppData\Local\Temp\arduino_modified_sketch_371941\sketch_feb10a.ino: In function 'void pingss()':
sketch_feb10a:66: error: 'ICMPEchoReply' was not declared in this scope
ICMPEchoReply echoReply = ping(pingAddr, 4);
^
sketch_feb10a:67: error: 'echoReply' was not declared in this scope
if (echoReply.status == SUCCESS)
^
sketch_feb10a:67: error: 'SUCCESS' was not declared in this scope
if (echoReply.status == SUCCESS)
^
Несколько библиотек найдено для "Ethernet.h"
Используется: C:\Users\1\Documents\Arduino\libraries\Ethernet
Не используется: C:\Program Files (x86)\Arduino\libraries\Ethernet
Несколько библиотек найдено для "ICMPPing.h"
Используется: C:\Program Files (x86)\Arduino\libraries\ICMPPing
Не используется: C:\Program Files (x86)\Arduino\libraries\icmp_ping
exit status 1
no matching function for call to 'ICMPPing::ICMPPing(SOCKET&, uint16_t)'
Этот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
"Показать подробный вывод во время компиляции"
_______________________________________________________________________________________
Помогите разобраться в чем проблема?????
Библиотека ICMPPing.h не та. Попробуйте вот эту.