1 (edited by inaara.damani28 2019-01-13 10:09:55)

Topic: Two text strings only one text string displays

I have put two text strings one after the another and in the first text string i am displaying the temperature and in the second text string im displaying the suggestion of turning ON/OF the heater/cooler.....i tried all the ways...it has been so many days since im trying bt the second text string is displaying blank when i connect to the wifi module...the suggestion is not getting displayed but the temperature is getting displayed...what should i do...i want to display both simultaneously in respective text strings

2

Re: Two text strings only one text string displays

Show your code.

3

Re: Two text strings only one text string displays

MODULE 1 CODE:-
/* RemoteXY select connection mode and include library */ 
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h> 

/* RemoteXY connection settings */ 
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200 
#define REMOTEXY_WIFI_SSID "Project"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377

/* RemoteXY configurate  */ 
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,2,0,29,0,123,0,8,33,1,
  130,1,1,0,61,36,82,130,1,1,
  38,61,30,82,129,0,9,1,46,6,
  8,84,69,77,80,69,82,65,84,85,
  82,69,0,67,5,4,9,55,13,16,
  201,8,67,5,4,24,55,9,16,201,
  21,129,0,19,40,25,6,8,72,69,
  65,84,69,82,0,2,1,6,48,50,
  16,1,26,31,31,79,78,0,79,70,
  70,0,130,1,1,70,61,29,82,129,
  0,19,72,26,6,8,67,79,79,76,
  69,82,0,2,1,7,80,49,16,135,
  26,31,31,79,78,0,79,70,70,0 };
   
/* this structure defines all the variables of your control interface */ 
struct { 
   
     /*input variable*/
  uint8_t switch_1; // =1 if switch ON and =0 if OFF
  uint8_t switch_2; // =1 if switch ON and =0 if OFF
   
    /* output variable */
  char text_1[30];  /* string end zero UNICODE */
  char text_2[22];
 
    /* other variable */
  uint8_t connect_flag;   /* =1 if wire connected, else =0 */

} RemoteXY; 
#pragma pack(pop)

#define PIN_SWITCH_1 13
#define PIN_SWITCH_2 12

void setup()   

  RemoteXY_Init ();
  pinMode (PIN_SWITCH_1, OUTPUT);
  pinMode (PIN_SWITCH_2, OUTPUT);         

void loop()   
{   
  RemoteXY_Handler (); 
  /* get the ADC value */
  int sensorValue = analogRead(A0);     
  double mv = (sensorValue/1024.0)*5000;
  double temp = mv/10;
  dtostrf(temp, 0, 2, RemoteXY.text_1);
  if(temp>=25.00)
  {
    sprintf(RemoteXY.text_2,"HEATER");
  }
  else
  {
sprintf(RemoteXY.text_2,"COOLER");
  }
  /*convert the temperature value into a string 
    and place it immediately in the field text_1 patterns RemoteXY 
  */ 
  Serial.print("TEMPERATURE = ");
  Serial.print(temp);
  Serial.print("*C"); 
  Serial.println();
  delay(1200);       

digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2==0)?LOW:HIGH);
}

4 (edited by Guillaume 2019-01-14 03:46:13)

Re: Two text strings only one text string displays

char text_1[30];  /* string end zero UNICODE */ 
char text_2[22];

Did you manually modify the sizes of these arrays ? According to the values in RemoteXY_CONF, their size should be 8 and 21, not 30 and 22.

5 (edited by inaara.damani28 2019-01-14 03:51:26)

Re: Two text strings only one text string displays

Yess i manually changed them...so we can't change the sizes manually?
Do you know how to read the coordinates of RemoteXY_CONF?
If yes then please explain

6 (edited by Guillaume 2019-01-14 03:56:09)

Re: Two text strings only one text string displays

You can but only if you change it in RemoteXY_CONF too

Here is the part corresponding to these arrays:

67,5,4,9,55,13,16,201,8  // text_1
67,5,4,24,55,9,16,201,21 // text_2

The last number of each line must match the size of the array in the RemoteXY struct


Want to know more about manual modification, read this topic, it is outdated, things changed, but it should still be relevant in most cases wink

7

Re: Two text strings only one text string displays

Oh Thank you soo muchh...

8

Re: Two text strings only one text string displays

I forgot to say that you must also increase the fourth byte of the RemoteXY_CONF array.

As you see actually it's 29:

255,2,0,29,...

Which is 8 + 21.

This byte must match the total of the sizes of these arrays. If total is more than 255, then the fifth byte must also be increased (it's a 16 bits value so it is split in two bytes).

9 (edited by inaara.damani28 2019-01-16 13:23:26)

Re: Two text strings only one text string displays

Ok fine ..thanks...i have 3 more doubts
1)Can we send SMS to the user using the remoteXY?
2) How can we go on the next page using the page element and edit the components of second page on the editor of remoteXY?
3) How can we enable disable the components in code?

10 (edited by Guillaume 2019-01-16 17:31:22)

Re: Two text strings only one text string displays

1) Not possible to send SMS, at least not at the moment and maybe never because it seems development of RemoteXY is stopped. The last update took about one year to come and it was only to fix a few bugs so I doubt new features will be added anytime soon (but I hope I'm wrong).

2) Add two Page elements, then when you add another element you can choose on which page it must be displayed, or if it must be displayed on all Pages. Click on a Page element to go to that Page.

3) Not possible..

11 (edited by inaara.damani28 2019-01-21 16:12:00)

Re: Two text strings only one text string displays

Can we code on the page element of remotexy?
I want that when the user clicks on a certain page element then only my code should run
So basically i want to code on the page element...that if the page element is clicked then only certain block of code will execute.....is this possible?

12

Re: Two text strings only one text string displays

Not possible, I have already suggested something about this, like 2 or 3 years ago.. Either a callback system ( onPageChanged ) or even a simple variable like

struct { 
  ...
    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 
  uint8_t current_page;

} RemoteXY;

But our suggestions seems to be ignored... sad