<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — Getting time from the Arduino controller]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=2114</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=2114&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Getting time from the Arduino controller.]]></description>
		<lastBuildDate>Sat, 28 Feb 2026 23:42:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6389#p6389</link>
			<description><![CDATA[<p>Thank you so much! I do appreciate your addressing this.</p><p>I&#039;m still figuring out the details of time functions, but I&#039;m now having some success instead of all failures.</p><p>Thanks again!</p><p>Gary<br />--</p>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sat, 28 Feb 2026 23:42:29 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6389#p6389</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6387#p6387</link>
			<description><![CDATA[<p>We found a bug and fixed it. Try again. Your previous code should work.</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Wed, 25 Feb 2026 13:21:53 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6387#p6387</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6356#p6356</link>
			<description><![CDATA[<p>I&#039;m so sorry for continuing this tread, but I can&#039;t get this time thing to work.</p><p>Can someone please check me?</p><p>This is the editor page with only one element: RealTime&nbsp; <a target="_blank" href="https://remotexy.com/en/editor/f35ea218e42dee952b4006a6a8015353/">https://remotexy.com/en/editor/f35ea218 … 6a8015353/</a></p><p>It&#039;s running on a Samsung S21 phone using Android 15. The version of RemoteXY is 4.18.03.</p><p>Is this code valid?</p><div class="codebox"><pre><code>/*
   -- Testing time 1 --
   For MEGA2560 and BT on Serial port 2

   To compile this code using RemoteXY library 4.1.8 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.18.03 or later version;
     - for iOS 1.14.1 or later version;
    
   To interact with the GUI, please refer to the manual: 
   https://remotexy.com/ru/help/code/interaction/

   This source code was automatically generated by the RemoteXY editor and 
   is an example for the RemoteXY library. 
   Licensed under the MIT License. See the LICENSE file in the RemoteXY library
   root (https://github.com/RemoteXY/RemoteXY-Arduino-library) for full license 
   details.             
*/

//////////////////////////////////////////////
//        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__HARDSERIAL


// RemoteXY connection settings 
#define REMOTEXY_SERIAL Serial2
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_ACCESS_PASSWORD &quot;1234&quot;


#include &lt;RemoteXY.h&gt;

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t const PROGMEM RemoteXY_CONF_PROGMEM[] =   // 44 bytes V21 
  { 254,0,0,0,0,1,0,0,0,33,0,21,0,0,0,72,80,32,77,101,
  116,101,114,32,66,117,100,100,121,0,31,1,200,112,1,1,1,0,193,92,
  31,11,11,3 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // complex variables
  RemoteXYType_RealTime realTime_01; // use .getTimeStamp(), .getTime()

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

void setup(){

  RemoteXY_Init ();                                           
  Serial.begin(115200);

}

void loop() {                                                
  RemoteXYEngine.handler ();   
  
  RemoteXYTime time = RemoteXY.realTime_01.getTime(-360);

    if (!time.isEmpty()) {
      Serial.print(&quot;Time: &quot;);
      Serial.println(time.format(&quot;HH:mm:ss&quot;));
    }

  RemoteXYEngine.delay(1000);
}    </code></pre></div><p>When this code runs, I get no serial output:</p><div class="codebox"><pre><code>...nothing to see here...</code></pre></div><p>Removing the &quot;if (!time.isEmpty())&quot; section prints:</p><div class="codebox"><pre><code>Time: 00:00:00
Time: 00:00:00
Time: 00:00:00
...and so on and so on...</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sun, 08 Feb 2026 17:05:45 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6356#p6356</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6353#p6353</link>
			<description><![CDATA[<p>Thank you for your response.</p><p>My project is monitoring a voltmeter (up to 10 times per second) and I&#039;m wanting to log the exact time when a reading changes, down to the milliseconds. The voltage-changing event is then saved to an SD card in a CSV file.</p><p>I can get the time from the tablet (Android tablet in my case) using your code or my code. Problem is, if this my only access to the time, the time captured will be delayed and not accurate.</p><p>I&#039;m trying to get a timestamp from the Arduino MEGA to log an accurate millisecond-level timestamp. This is what I&#039;m trying to do with no success at all. As I read the published information, it seems I should be able to get a timestamp from the Arduino that is accurate to the milliseconds. </p><p>Question: Must I get the current time from the tablet when I want the current time, or can I get the time (timestamp) from the Arduino program? </p><p>Thank you so much again for your help.</p><p>Gary<br />--</p>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sat, 07 Feb 2026 02:43:20 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6353#p6353</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6348#p6348</link>
			<description><![CDATA[<p>First, when the application connects and the RemoteXYEngine.appConnected() flag is True, this doesn&#039;t mean the time has already been read from the controller. In your code, as soon as the connection is established, you immediately try to read the time, but it hasn&#039;t yet been read from the application. Don&#039;t do this. You simply need to check whether the time field is empty. And once it&#039;s no longer empty, you can use it.</p><div class="codebox"><pre><code>int doOnce = 0;
void loop() {                                                
  RemoteXYEngine.handler ();   
  if (doOnce == 0) {
    RemoteXYTime time = RemoteXY.realTime_01.getAppTime();
    if (!time.isEmpty ()) {
      Serial.println (time.format(&quot;d MMM YYYY, HH:mm:ss&quot;));
      doOnce = 1;
      // TO DO somethings 
    }     
  }                                  
}    </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Thu, 05 Feb 2026 09:38:47 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6348#p6348</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6346#p6346</link>
			<description><![CDATA[<p>I know I&#039;m talking to myself here, but...</p><p>I&#039;m using the example in the manual and I still can&#039;t get back a real time from the Arduino.</p><p>What am I missing?</p><div class="codebox"><pre><code>/*
   -- Testing time 1 --
   For MEGA2560 and BT on Serial port 2

   To compile this code using RemoteXY library 4.1.8 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.18.03 or later version;
     - for iOS 1.14.1 or later version;
    
   To interact with the GUI, please refer to the manual: 
   https://remotexy.com/ru/help/code/interaction/

   This source code was automatically generated by the RemoteXY editor and 
   is an example for the RemoteXY library. 
   Licensed under the MIT License. See the LICENSE file in the RemoteXY library
   root (https://github.com/RemoteXY/RemoteXY-Arduino-library) for full license 
   details.             
*/

//////////////////////////////////////////////
//        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__HARDSERIAL


// RemoteXY connection settings 
#define REMOTEXY_SERIAL Serial2
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_ACCESS_PASSWORD &quot;1234&quot;


#include &lt;RemoteXY.h&gt;

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t const PROGMEM RemoteXY_CONF_PROGMEM[] =   // 44 bytes V21 
  { 254,0,0,0,0,1,0,0,0,33,0,21,0,0,0,72,80,32,77,101,
  116,101,114,32,66,117,100,100,121,0,31,1,200,112,1,1,1,0,193,92,
  31,11,11,3 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // complex variables
  RemoteXYType_RealTime realTime_01; // use .getTimeStamp(), .getTime()

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

int doOnce = 0;                                                   //Flag to getting App Time once

void setup(){
  RemoteXY_Init ();                                           //Initialization by macros 
  Serial.begin(115200);                                       //Serial monitor debug
}

void loop(){                                                  //Main loop
  RemoteXYEngine.handler ();   
  checkAppConnected();                                        //Time testing in this function
  RemoteXYEngine.delay(1000);                                 //Simulate meter loop cycle speed
}

/*---------------------------------------------------------------------------------------------
=====================  checkAppConnected()  ===================================================
---------------------------------------------------------------------------------------------*/

void checkAppConnected(){
  
  if (!RemoteXYEngine.appConnected()) return;                             //Wait for app to connect...
  if (doOnce == 0){                                                       //...then get app time ONCE
    RemoteXYEngine.delay(1000);                                           //Getting time too soon after
                                                                          //  connection is unstable
    RemoteXYTime time = RemoteXYTime(RemoteXY.realTime_01.getAppTime());  //THIS WORKS - will set time to app time
    doOnce = 1;                                                           //Set flag (done once)
    Serial.println (time.format(&quot;d MMM YYYY, HH:mm:ss&quot;));                 //THIS WORKS - Prints the current time
    Serial.println(&quot;Done once...&quot;);                                       //Debug - made it through once
    return;                                                               //Return after done once
  }

  // The following (verbatim) from the manual on the website does not work.
  // It never print any time, because time = Epoch time. I commented out .isEmpty line to be sure.
  
    int timeZone = 5 * 60; // UTC+5
     RemoteXYTime time = RemoteXY.realTime_01.getTime(timeZone);
    //if (!time.isEmpty ()) {                                             //Commented out to &#039;see&#039; what time was
      Serial.println (time.format(&quot;d MMM YYYY, HH:mm:ss&quot;));               //Prints &quot;1 Jan 1970, 00:00:00&quot; 
     
}</code></pre></div><p>With the .isEmpty line commented out, this is what I get:</p><div class="codebox"><pre><code>2 Feb 2026, 19:05:49
Done once...
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00
1 Jan 1970, 00:00:00</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Tue, 03 Feb 2026 01:26:13 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6346#p6346</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6345#p6345</link>
			<description><![CDATA[<p>Can someone give me an example of using this?:</p><div class="codebox"><pre><code>int64_t getTimeStamp ()</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sun, 01 Feb 2026 03:01:57 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6345#p6345</guid>
		</item>
		<item>
			<title><![CDATA[Re: Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6344#p6344</link>
			<description><![CDATA[<p>Incase it&#039;s not clear, I&#039;m trying to get the running time from the board after setting the time via the app. I&#039;m missing something, but I can&#039;t see it.</p><p>I&#039;m using an Arduino MEGA 2560 that&#039;s running well on a meter monitoring program. Adding RealTime is the only changes.</p><p>This is the code, stripped to just the RealTime element. It includes a number of attempts to make this work, but is not all the ways I&#039;ve tried. Of those that will read the app time, nothing I do can make the time actually run.</p><div class="codebox"><pre><code>/*
   -- Testing time 1 --
   For MEGA2560 and BT on Serial port 2

   To compile this code using RemoteXY library 4.1.8 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.18.03 or later version;
     - for iOS 1.14.1 or later version;
    
   To interact with the GUI, please refer to the manual: 
   https://remotexy.com/ru/help/code/interaction/

   This source code was automatically generated by the RemoteXY editor and 
   is an example for the RemoteXY library. 
   Licensed under the MIT License. See the LICENSE file in the RemoteXY library
   root (https://github.com/RemoteXY/RemoteXY-Arduino-library) for full license 
   details.             
*/

//////////////////////////////////////////////
//        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__HARDSERIAL


// RemoteXY connection settings 
#define REMOTEXY_SERIAL Serial2
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_ACCESS_PASSWORD &quot;1234&quot;


#include &lt;RemoteXY.h&gt;

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t const PROGMEM RemoteXY_CONF_PROGMEM[] =   // 44 bytes V21 
  { 254,0,0,0,0,1,0,0,0,33,0,21,0,0,0,72,80,32,77,101,
  116,101,114,32,66,117,100,100,121,0,31,1,200,112,1,1,1,0,193,92,
  31,11,11,3 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // complex variables
  RemoteXYType_RealTime realTime_01; // use .getTimeStamp(), .getTime()

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

// Set my me...
int doOnce = 0;                                             //Get time once flag, 0 = not done once
void checkAppConnected();                                   //Function to load and test time
RemoteXYTime time;                                          //RemoteXY example variable moved to global variable

void setup(){
  RemoteXY_Init ();                                         //Initialization by macros 
  Serial.begin(115200);                                     //Serial monitor debug
}

void loop(){                                                //Main loop
  RemoteXYEngine.handler ();   
  checkAppConnected();                                      //Time testing in this function
  RemoteXYEngine.delay(300);                                //Simulate meter loop cycle speed
}

void checkAppConnected(){
  if (!RemoteXYEngine.appConnected()) return;               //Wait for app to connect...
  
  if (doOnce == 0){                                         //...then get app time ONCE
    RemoteXYEngine.delay(1000);                             //Getting time too soon after the
  //                                                        //  app connects is unstable
  //
  //  time = RemoteXY.realTime_01.getAppTime();             //Works but time does not run
  //  time.set(RemoteXY.realTime_01.getAppTime());          //Works but time does not run
  //  time = RemoteXY.realTime_01.getAppTimeStamp();        //Works but time does not run
  time = RemoteXYTime(RemoteXY.realTime_01.getAppTime());   //Works but time does not run
  //  time = RemoteXY.realTime_01.getTime();                //Fails to compile - no matching function
  //  time = RemoteXY.realTime_01.getTimeStamp();           //Fails to compile - no matching function
    doOnce = 1;                                             //Set flag (done once)
    Serial.println (time.format(&quot;d MMM YYYY, HH:mm:ss&quot;));   //Debug time
    Serial.println(&quot;Done once...&quot;);                         //Debug - made it through once
    return;                                                 //Return after done once
  }

    int timeZone = -6 * 60; // UTC-5                        //Check to see if time is running...
    time = RemoteXY.realTime_01.getTime(timeZone);  //**    //...With this line Epoch = 0
    if (!time.isEmpty ()) {                                 //...Without above line, time only
      Serial.println (time.format(&quot;d MMM YYYY, HH:mm:ss&quot;)); //   equals the original time set once
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sat, 31 Jan 2026 22:11:18 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6344#p6344</guid>
		</item>
		<item>
			<title><![CDATA[Getting time from the Arduino controller]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=6343#p6343</link>
			<description><![CDATA[<p>I&#039;m using the RealTime element.</p><p>I can get the time from the app and use it in my sketch with the example in the documents:</p><div class="codebox"><pre><code>time = RemoteXY.realTime_01.getAppTime();</code></pre></div><p>...but I can&#039;t get the time from the Arduino controller. Seems I&#039;ve tried everything without success. Either it fails to compile or it ignores updating the time. I don&#039;t think I understand the &#039;format&#039; needed to do this, so I&#039;m just guessing... and that&#039;s not working out.</p><p>Can someone please provide a simple example of getting the time from the controller?</p><p>Thank you,</p><p>Gary<br />--</p>]]></description>
			<author><![CDATA[null@example.com (ytvytv1)]]></author>
			<pubDate>Sat, 31 Jan 2026 15:04:06 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=6343#p6343</guid>
		</item>
	</channel>
</rss>
