How to get the ip address as a variable?

hello!

i’ve got 2 questions:

  • it is possible to get the ip address assigned by the router for the arduino, and also the routers ip address? what commands should i use? i would like to trigger some actions in my code if the ip address matches a specific pattern.

  • how to send commands to the arduino (with blynk running and connected to internet) from my pc, or email? i see that it is possible to send email from the arduino via blynk.email command, but the reverse is possible? to trigger an action with an email, or some program from a pc.

thank you!

There is REST Api made by Arduino, or you can use sth else, you need some sort of socket on Arduino to parse incoming messages.

thanks!
any ideas for getting the ip addresses ? when i enable the blynk debugging (#define BLYNK_DEBUG and #define BLYNK_PRINT Serial), at startup, in the serial monitor i see the ip assigned by the router, but i do not know how to use it as a variable…

I believe that WiFi.localIP() holds IP address I don’t know what kind of device you use anyway

i use arduino mega with enc28j60 ethernet module + uipethernet library.

there is localIP() function in this library so you can call it from your class instance. It will return variable of type IPAdress

1 Like

IPAddress strWiFiIp= WiFi.localIP();

1 Like

hello!

i tested the localIP() function, it works, thanks.
still looking for a way to get the isp assigned ip for the router.