user42051: I tried connecting RX of GPS to Pin 18 and TX of GPS to Pin 19 but I get an error that No GPS is detected,check wiring.VCC of GPS to 5V.
I have set baudrate to 115200.I am trying DeviceExample code of TinyGPS++ library.

user14737: The default baud rate for ublox NEO-6M GPS devices is 9600, not 115200.
And try NeoGPS.  It's smaller, faster, more accurate, more reliable and it comes pre-configured to use Serial1 on a Mega.  Be sure to read the Installation instructions.  If it doesn't work, follow the Troubleshooting pages and try NMEAdiagnostic.ino.
NeoGPS has an example sketch (ubloxRate.ino) that can configure the NEO-6M to other baud rates, once you get the basic programs working at 9600.

42051: <p>I tried connecting RX of GPS to Pin 18 and TX of GPS to Pin 19 but I get an error that No GPS is detected,check wiring.VCC of GPS to 5V.</p>

<p>I have set baudrate to 115200.I am trying DeviceExample code of TinyGPS++ library.</p>
 14737: <p>The default baud rate for ublox NEO-6M GPS devices is 9600, <strong>not</strong> 115200.</p>

<p>And try <a href="https://github.com/SlashDevin/NeoGPS" rel="nofollow noreferrer">NeoGPS</a>.  It's smaller, faster, more accurate, more reliable and it comes pre-configured to use <code>Serial1</code> on a Mega.  Be sure to read the Installation instructions.  If it doesn't work, follow the Troubleshooting pages and try NMEAdiagnostic.ino.</p>

<p>NeoGPS has an example sketch (ubloxRate.ino) that can configure the NEO-6M to other baud rates, once you get the basic programs working at 9600.</p>
