Hi.
I’ve been trying to use Cellular.localIP() to get the local IP address.
My code is very simple:
void setup() {
Serial.begin(9600);
IPAddress localIP = Cellular.localIP();
Serial.println(localIP);
}
void loop() {
}
But having following error.
xxx.cpp: In function 'void setup()':
xxx.cpp:13:42: warning: 'IPAddress spark::NetworkClass::localIP()' is deprecated (declared at ../wiring/inc/spark_wiring_network.h:44): Please use WiFi.localIP() instead [-Wdeprecated-declarations]
^
../../../build/target/user/platform-10/libuser.a(gps.o): In function `setup':
xxx.cpp:13: undefined reference to `spark::NetworkClass::localIP()'
collect2: error: ld returned 1 exit status
So I have used the following code .
void setup() {
Serial.begin(9600);
IPAddress localIP = WiFi.localIP();
Serial.println(localIP);
}
void loop() {
}
But having following error.
xxx.cpp: In function 'void setup()'
xxx.cpp:13:25: error: 'Wifi' was not declared in this scope
What am I doing wrong?