1

Topic: Alternative Arduino SoftwareSerial library

Hello, I am a happy RemoteXY user and I congratulate you on the excellent work you have done.
I ran into a strange problem related to the arduino SoftwareSerial library that doesn't get along well with interrupts.
The problem is known and much discussed on the web: in many cases where the software serial and the i2c protocol are used, one of the two does not work well.
My case is an arduino nano connected to an ESP8266 with the SoftwareSerial and to an i2c oled display and an adafruit MLX90614 sensor always i2c.
I can read the sensor and send the data via RemoteXY but the display does not work, if I disable the software serial (and consequently RemoteXY) I can read the results on the display.
Some people who had similar problems, not with RemoteXY but only with the software serial, have solved it using the "AltSoftSerial Library".
I was wondering if there was a way to use this library instead of the standard "SoftwareSerial" with RemoteXY.
Sorry for my English!!!! (I used google translate ....)
Many thanks!!

2

Re: Alternative Arduino SoftwareSerial library

RemoteXY uses the standard SoftwareSerial library. All its features about which you write will also appear in the RemoteXY. This is a known issue. The best solution is to use a hardware serial to communicate with the ESP.
Also the SoftwareSerial.h is not compatible with:
- servo.h

We will explore the possibility of integrating with AltSoftSerial

3 (edited by arduquadsonarwii 2022-10-28 01:33:21)

Re: Alternative Arduino SoftwareSerial library

Hi, I just found RemoteXY, have not used it in any real test. But it looks exactly what I need for my quadcopter. But, when working with my code I found out that: 1. I got an error of multiple definition of vector_3 when compiling if I use softserial; 2. I got an error complaining multiple definition of vector_18 and 19 when compiling if I use hardwareserial because it conflicts with serial.cpp "openserial" function called in setup() inside multiwii.cpp. It appears once multiwii starts, the hardwareserial is opened. Looks like the only alternative is AltSoftSerial, It would be great if this is integrated into RemoteXY.

4

Re: Alternative Arduino SoftwareSerial library

The 3.1.10 library  beta version includes this feature. But the editor does not support now.
Link from github https://github.com/RemoteXY/RemoteXY-Ar … master.zip
The code for example

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ALTSOFTSERIAL
#include <AltSoftSerial.h>

#include <RemoteXY.h>

// RemoteXY connection settings 
#define REMOTEXY_SERIAL_SPEED 9600


// RemoteXY configurate  
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 19 bytes
  { 255,1,0,0,0,12,0,16,31,1,1,0,26,43,12,12,2,31,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t button_1; // =1 if button pressed, else =0 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////



void setup() 
{
  RemoteXY_Init (); 
  
  
  // TODO you setup code
  
}

void loop() 
{ 
  RemoteXY_Handler (); 
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay() 

}

5 (edited by demonup 2024-06-27 13:48:13)

Re: Alternative Arduino SoftwareSerial library

remotexy wrote:

The 3.1.10 library  beta version includes this feature. But the editor does not support now.
Link from github https://github.com/RemoteXY/RemoteXY-Ar … master.zip
The code for example

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ALTSOFTSERIAL
#include <AltSoftSerial.h>

#include <RemoteXY.h>

// RemoteXY connection settings 
#define REMOTEXY_SERIAL_SPEED 9600


// RemoteXY configurate  
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 19 bytes
  { 255,1,0,0,0,12,0,16,31,1,1,0,26,43,12,12,2,31,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t button_1; // =1 if button pressed, else =0 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////



void setup() 
{
  RemoteXY_Init (); 
  
  
  // TODO you setup code
  
}

void loop() 
{ 
  RemoteXY_Handler (); 
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay() 

}

I used this code and got errors:

In file included from c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXY.h:162:0,
                 from C:\Users\\AppData\Local\Temp\.arduinoIDE-unsaved2024527-1764-ki1aor.fiirm\sketch_jun27a\sketch_jun27a.ino:9:
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_AltSoftSerial.h: In constructor 'CRemoteXYStream_AltSoftSerial::CRemoteXYStream_AltSoftSerial(long int)':
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_AltSoftSerial.h:26:28: error: conversion from 'AltSoftSerial*' to non-scalar type 'AltSoftSerial' requested
     AltSoftSerial serial = new AltSoftSerial ();
                            ^~~~~~~~~~~~~~~~~~~~
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_AltSoftSerial.h:27:11: error: base operand of '->' has non-pointer type 'AltSoftSerial'
     serial->begin (_serialSpeed);
           ^~
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_AltSoftSerial.h:28:22: error: no matching function for call to 'CRemoteXYStream_AltSoftSerial::setStream(AltSoftSerial&)'
     setStream (serial);
                      ^
In file included from c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYApi.h:21:0,
                 from c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXY.h:156,
                 from C:\Users\\AppData\Local\Temp\.arduinoIDE-unsaved2024527-1764-ki1aor.fiirm\sketch_jun27a\sketch_jun27a.ino:9:
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_Stream.h:36:8: note: candidate: void CRemoteXYStream_Stream::setStream(Stream*)
   void setStream (Stream * _stream) {
        ^~~~~~~~~
c:\Users\\Documents\Arduino\libraries\RemoteXY\src/RemoteXYStream_Stream.h:36:8: note:   no known conversion for argument 1 from 'AltSoftSerial' to 'Stream*'

exit status 1

Compilation error: exit status 1

ArduinoIDE 2.3.2
RemoteXY 3.13
AltSoftSerial 1.4
Arduino Nano Atmega328p

6

Re: Alternative Arduino SoftwareSerial library

We will fix it in the next version of the library.
You can now replace the RemoteXYStream_AltSoftSerial.h file from the repository https://github.com/RemoteXY/RemoteXY-Ar … ftSerial.h