router

Hello my pc is connected to a wireless router. my internet incoming connection is connected to the router. I want to connect my arduino mega 2560 to the router. how i will assign the IP settings to my arduino? I think the IP of my router is being assigned by the ISP and that it is changing. How to decide subnet mask and gateway?

thanks in advance.

You need a Wifi shield or something like it to connect to your router.

If the router has a spare LAN Ethernet port (many do) you can connect an ethernet cable between the router and an Arduino Ethernet Shield on your Mega 2560. Then use DHCP as in the various Ethernet examples to have the router assign a local IP address to the Arduino.

If the router does not have a spare LAN Ethernet port, or the router is too fare away to easily run a wire, connect an Arduino WiFi Shield to your Mega 2560. Then use DHCP as in the various WiFi examples to have the router assign a local IP address to the Arduino.

In either case you will need to configure a port forwarding on your router if you want to access the Arduino fro the outside world. If you only want the Arduino to access your LAN and the outside world you don't need port forwarding.