Using Second Serial Port on Arduino Uno

Hello,

I am working about GPS data parsing by using arduino uno on proteus programme. In this context, I used to 2 and 3 pins of arduino as Tx and Rx in Serial Com. via Software Serial library. But, as far as I understand, the program can't enter loop which working in case of Rx port is available.
Please help me about it. Thanks in advance.

I share the code below:

#include <SoftwareSerial.h>      // Include software serial library
#include <FuGPS.h>               // Include FuGPS library

SoftwareSerial in(3, 2);
FuGPS fuGPS(in);
bool gpsAlive = false;

void setup()
{
  Serial.begin(9600);
  in.begin(9600);

  fuGPS.sendCommand(FUGPS_PMTK_API_SET_NMEA_OUTPUT_RMCGGA);
  Serial.println("GPS Testing");
}

void loop()
{
  while (in.available() > 0)
  {
    Serial.println("Software Serial is available");
  }
  while (in.available() <= 0)
  {
    Serial.println("Software Serial is nonavailable");
  }

}

In the image below, I share the Proteus design and the result.

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

On real Uno it will be always "Software Serial is available" in serial monitor.

The Arduino does not lie, Proteus might lie.

If you are using GPS with multiple Serial prints() you should check out my tutorial on Arduino Serial I/O for the Real World which includes a GPS example with debugging.
Serial.print()s will block once the TX buffer fills up and you can miss GPS data.

Hi,
Now is the time to get the hardware out and BUILT IT.

A simulator is no match for the REAL WORLD.

Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.