1

Topic: How to add a device not yet supported....

My latest project is using the Teensy 3.2, which has 3 serial ports. I want to use RX/TX1 (pins 0/1) for the serial monitor in the Arduino IDE, and RX/TX2 (pins 9/10) for my RemoteXY interface.

Since you have to specify which serial port to use in the RemoteXY configuration as "Serial1" (the project does not compile without that 1 on the end), I chose the Arduino Micro as the module, which correctly gives me Serial1 as REMOTEXY_SERIAL

Now I want to move the RemoteXY interface to Serial2, to free up Serial1 for the IDE monitor, but have no way of telling the RemoteXY initialisation which pins to use for the serial comms.

Now I know I'm going to have to hack the library a bit to do this, but genuinely don't know where to look.  Does anyone know if this is at all possible, and where to achieve it ?

If the Module Configuration had been a little more "flexible", allowing us to choose the TX and RX pins, you would be able to use pretty much any hard serial port on any board, despite not having your target board as a listed and supported board.

2B, or not 2B, that is the pencil ...

2

Re: How to add a device not yet supported....

"#define REMOTEXY_SERIAL Serial2" not working ?

3 (edited by Daba 2019-02-25 09:31:37)

Re: How to add a device not yet supported....

Guillaume wrote:

"#define REMOTEXY_SERIAL Serial2" not working ?


Well I'm sort of getting there, but am now getting "Error: (61) Connection refused"

This is the sketch I am using to try and get this working, which works fine if I connect using Serial1

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

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT

#include <RemoteXY.h>

// RemoteXY connection settings 
#define REMOTEXY_SERIAL Serial2
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "TeensyTest"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


// RemoteXY configurate  
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,1,0,1,0,19,0,8,13,0,
  1,0,17,19,12,12,2,31,88,0,
  65,4,48,20,9,9 };
  
// this structure defines all the variables of your control interface 
struct {

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

    // output variable
  uint8_t led_1_r; // =0..255 LED Red brightness 

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

} RemoteXY;
#pragma pack(pop)

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



// **********************************************************************

void setup() {

  RemoteXY_Init (); 
 
} // end setup

// ***********************************************************************
// LOOP
// ***********************************************************************

void loop() {

  RemoteXY_Handler ();
 
  RemoteXY.led_1_r = RemoteXY.button_1 * 255;

  delay(25);
  
} // void(loop)
2B, or not 2B, that is the pencil ...

4

Re: How to add a device not yet supported....

I know this post is a little old, but I would think that you would use Software Serial instead of Hardware Serial (selected under 'Module interface->Connection interface:'  in the Editor).

The Software Serial allows you to choose whatever pins you want for the Rx / TX lines (but more limited selections for Baud Rate).

Here is a code segment I generated that I think is what you where aiming for:

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

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ESP8266_SOFTSERIAL_POINT
#include <SoftwareSerial.h>

#include <RemoteXY.h>

// RemoteXY connection settings 
#define REMOTEXY_SERIAL_RX 9
#define REMOTEXY_SERIAL_TX 10
#define REMOTEXY_SERIAL_SPEED 19200
#define REMOTEXY_WIFI_SSID "TeensyTest"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


// RemoteXY configurate  
#pragma pack(push, 1)