Conflicting declaration

I am trying to assign a Serial port object to a Stream so that it can be switched as required to the appropriate device. At some point I would like to be able to optionally send data to a file on SD card as well. For now I am focusing on the serial port, which as we know can be HardwareSerial, Serial_ (i.e. CDC) or SoftwareSerial. If I assign the first two, the compiler accepts the statement:

Stream& dataStream = Serial;

But if I try to do this with a SoftwareSerial object like this:

    #include <SoftwareSerial.h>

    SoftwareSerial swArSerial(SW_SERIAL_RX_PIN, SW_SERIAL_TX_PIN);
    Stream& dataStream = swDbSerial;

The I get:

conflicting declaration 'Stream& swDbSerial'

The SoftwareSerial class is defined as:

class SoftwareSerial : public Stream

So I am a bit puzzled. Unfortunately even with verbose mode on, the compiler does not reveal any more information other than the SoftwareSerial library is version 1.0.

I see where you declare 'swArSerial' but where do you declare 'swDbSerial'?

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