<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Values outputting to the wrong indicators]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1933&amp;type=atom" />
	<updated>2025-03-12T13:32:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1933</id>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5958#p5958" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>remotexy wrote:</cite><blockquote><p>Just don&#039;t change anything in the RemoteXY structure. Copy it as is. Something you added or manually corrected caused the error. Just copy and paste.</p></blockquote></div><p>I always copy everything between the first /////////////////// line, to the last //////////////// line.</p><p>I then have a separate tabbed page on my sketch that just has the RemoteXY definition in it. I use an #include<br /> statement in my main code so that the GUI configuration gets pulled in.</p><p>Once I&#039;ve copied the RemoteXY source code, it is then easy to go to the RemoteXY include page, do Ctrl-A (select All), then Ctrl-C (Paste) to replace all of the RemoteXY stuff.&nbsp; Sounds more difficult to describe than it is to do ...</p>]]></content>
			<author>
				<name><![CDATA[Daba]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=630</uri>
			</author>
			<updated>2025-03-12T13:32:44Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5958#p5958</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5924#p5924" />
			<content type="html"><![CDATA[<p>Thank you. Just buy the full version of the app and tell your friends about us.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2025-02-25T19:39:26Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5924#p5924</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5923#p5923" />
			<content type="html"><![CDATA[<p>Wow, I see....thanks. Do you have a Patreon or other way to tip? RemoteXY is too good to be this cheap.</p>]]></content>
			<author>
				<name><![CDATA[ATaylorwatts]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=3029</uri>
			</author>
			<updated>2025-02-25T14:08:04Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5923#p5923</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5919#p5919" />
			<content type="html"><![CDATA[<p>Just don&#039;t change anything in the RemoteXY structure. Copy it as is. Something you added or manually corrected caused the error. Just copy and paste.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2025-02-25T10:31:38Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5919#p5919</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5912#p5912" />
			<content type="html"><![CDATA[<p>I know I copied the code right. My program has other variables and I added the ones generated by remotexy to the structure. I tried to start over and now the input is somehow tied to the slider to the edit field.</p>]]></content>
			<author>
				<name><![CDATA[ATaylorwatts]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=3029</uri>
			</author>
			<updated>2025-02-22T00:17:21Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5912#p5912</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5909#p5909" />
			<content type="html"><![CDATA[<p>I copied the array and i have the variables that are from the structure. My code still works fine, but value indicators are switched up</p><p>RemoteXY Code:<br /></p><div class="codebox"><pre><code>/*
   -- v4 --
   
   This source code of graphical user interface 
   has been generated automatically by RemoteXY editor.
   To compile this code using RemoteXY library 3.1.13 or later version 
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                   
     - for ANDROID 4.15.01 or later version;
     - for iOS 1.12.1 or later version;
    
   This source code is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.    
*/

//////////////////////////////////////////////
//        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 &lt;SoftwareSerial.h&gt;

// RemoteXY connection settings 
#define REMOTEXY_SERIAL_RX 10
#define REMOTEXY_SERIAL_TX 11
#define REMOTEXY_SERIAL_SPEED 9600


#include &lt;RemoteXY.h&gt;

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] =   // 206 bytes
  { 255,10,0,8,0,199,0,19,0,0,0,0,31,1,106,200,1,1,14,0,
  2,4,13,29,13,0,2,26,31,31,79,78,0,79,70,70,0,2,4,37,
  31,12,0,2,26,31,31,79,78,0,79,70,70,0,129,9,4,16,9,64,
  17,76,69,68,0,129,8,30,21,7,64,17,69,110,97,98,108,101,0,2,
  89,5,11,6,0,2,26,31,31,79,78,0,79,70,70,0,2,89,14,12,
  5,0,2,26,31,31,79,78,0,79,70,70,0,4,21,99,14,67,0,2,
  26,4,69,99,15,66,0,2,26,129,16,171,23,8,64,24,83,112,101,101,
  100,0,129,61,171,32,8,64,8,68,105,115,116,97,110,99,101,0,67,8,
  92,40,10,78,2,26,2,67,56,92,40,10,78,2,26,2,7,53,39,40,
  10,110,64,2,26,2,2,129,54,31,39,7,64,17,83,119,105,116,99,104,
  32,84,105,109,101,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t LED; // =1 if switch ON and =0 if OFF
  uint8_t enable; // =1 if switch ON and =0 if OFF
  uint8_t dir; // =1 if switch ON and =0 if OFF
  uint8_t step; // =1 if switch ON and =0 if OFF
  int8_t Speed; // from 0 to 100
  int8_t Distance; // from 0 to 100
  float switchTime;

    // output variables
  float speed_indicator;
  float distance_indicator;

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

} RemoteXY;   
#pragma pack(pop)
 
/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

#define PIN_LED 13
#define PIN_ENABLE 4
#define PIN_DIR 2
#define PIN_STEP 3


void setup() 
{
  RemoteXY_Init (); 
  
  pinMode (PIN_LED, OUTPUT);
  pinMode (PIN_ENABLE, OUTPUT);
  pinMode (PIN_DIR, OUTPUT);
  pinMode (PIN_STEP, OUTPUT);
  
  // TODO you setup code
  
}

void loop() 
{ 
  RemoteXY_Handler ();
  
  digitalWrite(PIN_LED, (RemoteXY.LED==0)?LOW:HIGH);
  digitalWrite(PIN_ENABLE, (RemoteXY.enable==0)?LOW:HIGH);
  digitalWrite(PIN_DIR, (RemoteXY.dir==0)?LOW:HIGH);
  digitalWrite(PIN_STEP, (RemoteXY.step==0)?LOW:HIGH);
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay(), use instead RemoteXY_delay() 


}</code></pre></div><p>my code:<br /></p><div class="codebox"><pre><code>#define REMOTEXY_MODE__SOFTSERIAL
#include &lt;SoftwareSerial.h&gt;
#define REMOTEXY_SERIAL_RX 10
#define REMOTEXY_SERIAL_TX 11
#define REMOTEXY_SERIAL_SPEED 9600
#include &lt;RemoteXY.h&gt;

// RemoteXY configuration structure
#pragma pack(push, 1)  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] =   // 206 bytes
  { 255,10,0,8,0,199,0,19,0,0,0,0,31,1,106,200,1,1,14,0,
  2,4,13,29,13,0,2,26,31,31,79,78,0,79,70,70,0,2,4,37,
  31,12,0,2,26,31,31,79,78,0,79,70,70,0,129,9,4,16,9,64,
  17,76,69,68,0,129,8,30,21,7,64,17,69,110,97,98,108,101,0,2,
  89,5,11,6,0,2,26,31,31,79,78,0,79,70,70,0,2,89,14,12,
  5,0,2,26,31,31,79,78,0,79,70,70,0,4,21,99,14,67,0,2,
  26,4,69,99,15,66,0,2,26,129,16,171,23,8,64,24,83,112,101,101,
  100,0,129,61,171,32,8,64,8,68,105,115,116,97,110,99,101,0,67,8,
  92,40,10,78,2,26,2,67,56,92,40,10,78,2,26,2,7,53,39,40,
  10,110,64,2,26,2,2,129,54,31,39,7,64,17,83,119,105,116,99,104,
  32,84,105,109,101,0 };

struct {
  uint8_t LED;
  uint8_t enable;
  uint8_t dir;
  uint8_t step;
  int8_t Speed;
  int8_t Distance;
  float speed_indicator;
  float distance_indicator;
  uint8_t connect_flag;
  float switch_time;
} RemoteXY;
#pragma pack(pop)

#define PIN_LED 13
#define PIN_ENABLE 4
#define PIN_DIR 2
#define PIN_STEP 3

unsigned long previousStepTime = 0;
int stepCounter = 0;
int targetSteps = 0;
bool currentDirection = true; // true for one direction, false for the other

void setup() {
  RemoteXY_Init(); 
  pinMode(PIN_LED, OUTPUT);
  pinMode(PIN_ENABLE, OUTPUT);
  pinMode(PIN_DIR, OUTPUT);
  pinMode(PIN_STEP, OUTPUT);
  digitalWrite(PIN_ENABLE, LOW); // Enable the driver
}

void loop() {
  RemoteXY_Handler();
  
  // Update indicators and LED
  RemoteXY.speed_indicator = map(RemoteXY.Speed, 1, 100, 5000, 500);
  RemoteXY.distance_indicator = map(RemoteXY.Distance, 1, 100, 0, 16000);
  digitalWrite(PIN_LED, (RemoteXY.LED==0)?LOW:HIGH);
  
  // Control motor
  digitalWrite(PIN_ENABLE, (RemoteXY.enable==0)?HIGH:LOW); // Enable is active LOW
  
  if (RemoteXY.enable == 1) { // If motor is enabled
    unsigned long currentMicros = micros();
    if (currentMicros - previousStepTime &gt;= RemoteXY.speed_indicator) {
      previousStepTime = currentMicros;
      
      if (stepCounter &lt; RemoteXY.distance_indicator) {
        digitalWrite(PIN_DIR, currentDirection ? HIGH : LOW);
        digitalWrite(PIN_STEP, HIGH);
        delayMicroseconds(2); // Short delay for the step pulse
        digitalWrite(PIN_STEP, LOW);
        stepCounter++;
      } else {
        // Change direction and reset counter when target is reached
        currentDirection = !currentDirection;
        stepCounter = 0;
      }
    }
  } else {
    stepCounter = 0; // Reset counter when motor is disabled
  }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ATaylorwatts]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=3029</uri>
			</author>
			<updated>2025-02-21T02:23:31Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5909#p5909</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5906#p5906" />
			<content type="html"><![CDATA[<p>Most likely you did not copy the RemoteXY structure from the code that the editor gave you into your code.<br />If you changed something in the interface, you need to copy two things: RemoteXY_CONF array and RemoteXY structure. Copy it as is.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2025-02-20T17:18:56Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5906#p5906</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Values outputting to the wrong indicators]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5904#p5904" />
			<content type="html"><![CDATA[<p>I made screen that was working fine and then I added an Edit Field (switch_time). I changed the code based on the source code provided. The Switch Time field shows up but it displays what should be in the Speed indicator (all of the indicators are mixed up).</p><p>The only change I made was adding the Switch Time edit field, nothing else. See attached images. Any help would be greatly appreciated.</p><p><span class="postimg"><img src="https://i.ibb.co/6JPFL6tZ/IMG-20250220-080058.jpg" alt="https://i.ibb.co/6JPFL6tZ/IMG-20250220-080058.jpg" /></span><br /><span class="postimg"><img src="https://i.ibb.co/4RwZHQQT/IMG-20250220-080046.jpg" alt="https://i.ibb.co/4RwZHQQT/IMG-20250220-080046.jpg" /></span><br /><span class="postimg"><img src="https://i.ibb.co/7NYCrMJD/IMG-20250220-080051.jpg" alt="https://i.ibb.co/7NYCrMJD/IMG-20250220-080051.jpg" /></span><br /><span class="postimg"><img src="https://i.ibb.co/cKN1Trqb/1000011550.png" alt="https://i.ibb.co/cKN1Trqb/1000011550.png" /></span></p><p><span class="postimg"><img src="https://ibb.co/2YtdHXM6" alt="https://ibb.co/2YtdHXM6" /></span><br /><span class="postimg"><img src="https://ibb.co/nMqsFWWc" alt="https://ibb.co/nMqsFWWc" /></span><br /><span class="postimg"><img src="https://ibb.co/n8gmQdsy" alt="https://ibb.co/n8gmQdsy" /></span><br /><span class="postimg"><img src="https://ibb.co/nqDbkLp3" alt="https://ibb.co/nqDbkLp3" /></span></p>]]></content>
			<author>
				<name><![CDATA[ATaylorwatts]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=3029</uri>
			</author>
			<updated>2025-02-20T14:15:40Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5904#p5904</id>
		</entry>
</feed>
