Slider value esp32

Hi
Why the value of the slider are not displayed on serial monitor? It is show all the time zero = 0

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

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

#include <WiFi.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


#include <RemoteXY.h>

// RemoteXY GUI configuration
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 28 bytes
{ 255, 1, 0, 0, 0, 21, 0, 19, 0, 0, 0, 0, 31, 1, 106, 200, 1, 1, 1, 0,
  4, 27, 26, 19, 161, 0, 204, 1
};

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

  // input variables
  int8_t slider_01; // from 0 to 100

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

} RemoteXY;
#pragma pack(pop)

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



void setup()
{
  RemoteXY_Init ();
  Serial.begin(115200);
  RemoteXY.slider_01 = 10;
}

void loop()
{
  RemoteXY_Handler ();
int slider_01;
  // value = RemoteXY.slider ;
  //Serial.print("  text= ");
  //Serial.print(RemoteXY.value_01);
  Serial.print("   S = ");
  Serial.println(slider_01);
}

Simply because you define slider several time in your program.

Nothing change

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

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

#include <WiFi.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


#include <RemoteXY.h>

// RemoteXY GUI configuration
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 28 bytes
{ 255, 1, 0, 0, 0, 21, 0, 19, 0, 0, 0, 0, 31, 1, 106, 200, 1, 1, 1, 0,
  4, 27, 26, 19, 161, 0, 204, 1
};

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

  // input variables
  int8_t slider_01; // from 0 to 100

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

} RemoteXY;
#pragma pack(pop)

void setup()
{
  RemoteXY_Init ();
  Serial.begin(115200);
 // RemoteXY.slider_01 = 10;
}

void loop()
{
  RemoteXY_Handler ();
int slider_01;
  Serial.print("   S = ");
  Serial.println(slider_01);
}

If I comment in the loop I have an error

slider_01 and RemoteXY.slider_01 are two different variables

you need to read about structures.

seems it's clear you did not study more since this post

(and as it seems to be the same project, you should have continued in the other thread)

problem solved

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

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

#include <WiFi.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


#include <RemoteXY.h>

// RemoteXY GUI configuration
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 28 bytes
{ 255, 1, 0, 0, 0, 21, 0, 19, 0, 0, 0, 0, 31, 1, 106, 200, 1, 1, 1, 0,
  4, 27, 26, 19, 161, 0, 204, 1
};

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

  // input variables
int8_t slider_01; // from 0 to 100
      /* input variable */
  unsigned char slider_1; /* =0..100 slider position */

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

} RemoteXY;
#pragma pack(pop)

void setup()
{
  RemoteXY_Init ();
  Serial.begin(115200);
  RemoteXY.slider_01 = 10;
}

void loop()
{
  RemoteXY_Handler ();
//int slider_01;
  Serial.print("   S = ");
  Serial.println(RemoteXY.slider_01);
}

but did you understand why?

you would do yourself a favor and make your life easier if you spend just a bit of time studying the key concepts and statements in C++, variable scope, etc...

It is not important, I did it, no one suggested that.
unsigned char slider_1;

You "solve" a problem that you create. Classic Muenchhausen. You blame others for not finding the problem you create? Muenchhausen by Proxy.

I do not create the problem, I am new to this program and learning it.

You have that one = you're talking off topic.

that's not what fixed it.

what fixed it was the fact that you did use

instead of

if you did not understand that the difference is not the type but the fact that now you have only one variable (in the structure) then you did not make much progress..

Anyway, you don't seem to be willing to learn so good luck.

The code you posted is not your code? You wash your hands of making it, reading it, using it, failing with it, and blamed anyone but yourself for not finding the problem you caused?

You just refuse to accept where the problem originated... hey, but "you solved it," right?

Accepting the source of the problem is the solution.

How high can you count, tom?

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