1

Topic: App stucks with string input field

I have an simple arduino bluetooth sketch with five rmotexy elements: two string output fields, one button, one string edit field and one instrument.

If I push the button or edit something in the input field the App stucks and looses connection. The events does not even reach the arduino sketch.

By try and error i found out that everything works, as soon as I delete the edit field from remotexy.

It has nothing to to with the rest of the sketch, if I comment everything out exept the remotexy code it still stucks as soon as i push the button or edit in the field. Also tried with a new, clean sketch, same problem.

2

Re: App stucks with string input field

Even more strange, it depends of the size of the string edit field:

edit field 6 char long works, edit field 32 chars long stucks... and this is absolutely the only difference !??!


this works:

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

// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG

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

#include <SoftwareSerial.h>

// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600


#include <RemoteXY.h>

// RemoteXY GUI configuration
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 111 bytes
{ 255, 8, 0, 67, 0, 104, 0, 17, 0, 0, 0, 179, 2, 200, 126, 126, 200, 1, 1, 5,
  0, 67, 0, 2, 204, 12, 0, 6, 126, 10, 5, 2, 26, 33, 67, 6, 112, 90, 12, 18,
  167, 98, 12, 6, 2, 26, 33, 7, 104, 112, 90, 12, 18, 183, 98, 12, 6, 2, 26, 7,
  1, 88, 88, 24, 24, 54, 140, 24, 24, 0, 231, 31, 85, 86, 0, 71, 44, 10, 114, 114,
  2, 17, 122, 122, 56, 8, 2, 24, 135, 0, 0, 0, 0, 0, 0, 112, 66, 0, 0, 160,
  65, 0, 0, 32, 65, 0, 0, 0, 64, 24, 0
};

// this structure defines all the variables and events of your control interface
struct {

  // input variables
  char leer_voll[7]; // string UTF8 end zero
  uint8_t UV_Button; // =1 if button pressed, else =0

  // output variables
  char clima[33]; // string UTF8 end zero
  char freq[33]; // string UTF8 end zero
  int8_t level; // from 0 to 60

  // 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(), use instead RemoteXY_delay()

  if (RemoteXY.UV_Button) {RemoteXY.level = 50;}
        else{ RemoteXY.level = 10;}
}

this does not work and stuck, as soon as i push the button:

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

// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG

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

#include <SoftwareSerial.h>

// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600


#include <RemoteXY.h>

// RemoteXY GUI configuration
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 111 bytes
{ 255, 34, 0, 67, 0, 104, 0, 17, 0, 0, 0, 179, 2, 200, 126, 126, 200, 1, 1, 5,
  0, 67, 0, 2, 204, 12, 0, 6, 126, 10, 5, 2, 26, 33, 67, 6, 112, 90, 12, 18,
  167, 98, 12, 6, 2, 26, 33, 7, 104, 112, 90, 12, 18, 183, 98, 12, 6, 2, 26, 33,
  1, 88, 88, 24, 24, 54, 140, 24, 24, 0, 231, 31, 85, 86, 0, 71, 44, 10, 114, 114,
  2, 17, 122, 122, 56, 8, 2, 24, 135, 0, 0, 0, 0, 0, 0, 112, 66, 0, 0, 160,
  65, 0, 0, 32, 65, 0, 0, 0, 64, 24, 0
};

// this structure defines all the variables and events of your control interface
struct {

  // input variables
  char leer_voll[33]; // string UTF8 end zero
  uint8_t UV_Button; // =1 if button pressed, else =0

  // output variables
  char clima[33]; // string UTF8 end zero
  char freq[33]; // string UTF8 end zero
  int8_t level; // from 0 to 60

  // 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(), use instead RemoteXY_delay()

  if (RemoteXY.UV_Button) {
    RemoteXY.level = 50;
  }
  else {
    RemoteXY.level = 10;
  }
}

3

Re: App stucks with string input field

by try and error I found out that the maximum size of the string edit filed is 12 to get the thing working, from 13 on it stucks....

4

Re: App stucks with string input field

We uploaded your sketch to the Arduino Uno board and connected the HC-06 bluetooth module to 2 and 3 pins. This works very well. When we press the button, the connection is not broken and everything continues to work.
Tell me what board you have and what communication module?

5

Re: App stucks with string input field

Arduino Nano, different HC-06 Modules tried… formerly had other RemoteXY projects with this setup that worked.
I can switch on RemoteXY  debugging and send the output if this helps…

6

Re: App stucks with string input field

Can you try using old HC-06 modules? Unfortunately, we started to come across modules that work differently and have some delay in data transmission via Bluetooth. These modules have an internal buffer in which data is accumulated and transmitted only after some time, about a second.
And yes, a log from the controller would be nice.