Topic: Edit Field Bazaar Consequences
Hi all,
Just trying something really basic, which is sending a char string to the Arduino and then displaying it within serial monitor. My code is at the end of this message.
As a check, the code includes the basic LED operators, which all work fine when no text is sent.
When I send the text, nothing appears in the serial monitor and further more, both LEDs illuminate. It cant be down to the string being sent exceeding the field length, as that is set to 51 and this happens if I simply send a 'Y'
--------------------------------------------------------------------
//////////////////////////////////////////////
// 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 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 19200
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "123456789"
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,53,0,52,0,49,0,10,5,1,
2,0,32,15,22,11,2,26,31,31,
79,78,0,79,70,70,0,1,0,37,
35,12,12,2,31,88,0,7,36,34,
56,20,5,2,26,2,51,67,4,33,
66,20,5,2,26,52 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t Blue_LED; // =1 if switch ON and =0 if OFF
uint8_t button_1; // =1 if button pressed, else =0
char Text_2[51]; // string UTF8 end zero
// output variables
char Text_1[52]; // string UTF8 end zero
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_BLUE_LED 13
#define PIN_BUTTON_1 12
char receivedMsg; // New variable for received text.
void setup()
{
RemoteXY_Init ();
Serial.begin(9600);
pinMode (PIN_BLUE_LED, OUTPUT);
pinMode (PIN_BUTTON_1, OUTPUT);
// TODO you setup code
} // Close Setup.
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_BLUE_LED, (RemoteXY.Blue_LED==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1==0)?LOW:HIGH);
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay()
strcpy (receivedMsg, RemoteXY.Text_2); // Copy received text from RemoteXY app to new variable.
if (receivedMsg > "") { // Check if variable has data.
Serial.print("Message Received: "); // Print data to serial monitor.
Serial.println(receivedMsg);
receivedMsg = ""; // Reset variable to blank.
} // Close if.
} // Close loop