1 (edited by sanbi4 2019-12-30 12:44:41)

Topic: The problem with indicators

Hello everyone, there is a problem with the indicators. I use the latest version of the app on Android, the library for the Arduino IDE from the site.

The problem is that if I create 2 level indicators or use 2 text lines, respectively, in FLProg there are inputs on the block, you need to pass data from different Arduino inputs to the smatphone. if the data is changed on the same input, it results in the same readings on both indicators or text strings. But this happens when both inputs of the remote unit are connected in Fprog, once one input is released, only one level indicator starts working and the data on the second indicator is not duplicated.

What to do?

sketch from Arduino IDE:

[*]
#define REMOTEXY_MODE__HARDSERIAL
#include <RemoteXY.h>
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 9600
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = {0, 2, 19, 0, 8, 13, 0, 66, 1, 23, 18, 7, 16, 2, 26, 66, 1, 48, 18, 7, 16, 2, 26};
struct {
signed char level_1;
signed char level_2;
unsigned char connect_flag;
} RemoteXY;
#pragma pack(pop)

void setup()
{

RemoteXY_Init ();

}
void loop()
{

RemoteXY_Handler  ();





//Плата:1
RemoteXY.level_1 =  (analogRead (0));
RemoteXY.level_2 =  (analogRead (2));






}

[/*]

2

Re: The problem with indicators

Welcome,

I don't know, but there is one mistake in your code, analogRead return a value in range 0-1023 (on most arduino-compatible boards) and remotexy level want a value in range 0-100. Try with function map()